Groups | Blog | Home
all groups > flash actionscript > may 2004 >

flash actionscript : attachMovie vs createEmptyMovieClip & onPress


spookman
5/9/2004 10:12:01 PM
I create a movie clip two different ways. One with attachMovie, and another
with the createEmpyMovieClip. I want to put a mouse press listener on both of
these. But when I do, only the one I attachMovie with works. Here are my two
different implementations. Can anyone help me get the on press event handler
working on the movie clip I create using createEmptyMovieClip?

thanks
Bryan

-----------------------------------
WORKS
-----------------------------------
clip = page.attachMovie(frameName, frameName+myCount, depth);

clip.onPress = function() {
startDrag(this);
oldx = this._x;
oldy = this._y;
};

clip.onRelease = function() {
stopDrag();
// needs to know how to pop up the
// large version of the frame and
// image combined
this._x = oldx;
this._y = oldy;
};
-------------------------------------------------------
DOES NOT WORK
-------------------------------------------------------
clip = page.createEmptyMovieClip(frameName, depth );
clip.loadMovie( clipName );

clip.onPress = function() {
startDrag(this);
};
clip.onRelease = function() {
stopDrag();
};
mandingo
5/9/2004 11:40:01 PM
Hi,

I am not sure how you are actually going about creating your movieClips... but
this works.

this.createEmptyMovieClip("thisClip",1);
this["thisClip"].createTextField("thisText",2,100,50,150,16);
this["thisClip"]["thisText"].text = "something in the text field";
this["thisClip"]["thisText"].border = true;
this["thisClip"]["thisText"].background = true;
this["thisClip"]["thisText"].backgroundColor = 0x0099FF;
this["thisClip"].onPress = function(){
this.startDrag();
}
this["thisClip"].onRelease = function(){
stopDrag();
}


Hope that helps,
cheers,
Jeckyl
5/10/2004 9:47:27 AM
[quoted text, click to view]

just use

thisClip.createTextField...

etc

no need for this["thisClip"]
[quoted text, click to view]

AddThis Social Bookmark Button