Re: [Flashcoders] dynamically attaching a movie clip to a class/object
You should be assigning the movieclip reference being returned from attachMovie to your myPost variable: myPost = _root.attachMovie("signPost", "myPost", _root.getNextHighestDepth()); Without that, your "myPost" variable is gonna be pointing to nothing. ~Arul Prasad. On 9/12/07, Charles Parcell <[EMAIL PROTECTED]> wrote: > > You are not defining what the movie should be attached to. > > Try: > > _root.attachMovie("signPost", "myPost", _root.getNextHighestDepth()); > > Note that I removed this.getNextHighestDepth(). Because "this" does not > exist on the stage yet, you can not get its next highest depth. > > Charles P. > > > On 4/26/07, sebastian chedal <[EMAIL PROTECTED]> wrote: > > > > hello flash coders! > > > > ive just joined and there are some nice discussions here, i hope to > > contribute positivly to the level of knowledge in the group. > > :) > > > > i'm currently learning how to work in an OOP manner in flash, and thus > > meeting some basic hurdles. > > it would be very kind of you if you could assist me in my [probably very > > simple] problems. > > :-) > > > > I'm using external *.as files, and at the moment i am trying to figure > out > > how to attach a movie to it [should be simple, right?] > > > > my as file: > > > > class Post extends CoreClass { > > private var myPost:MovieClip; > > > > public function setCord(px,py,pz):Void { > > > > //set coordinates > > public var px:Number = px; > > public var py:Number = py; > > public var pz:Number = pz; > > //original point locations > > private var ox:Number = px; > > private var oy:Number = py; > > private var oz:Number = pz; > > } > > > > public function attachMe ():Void { > > attachMovie("signPost", "myPost", this.getNextHighestDepth()); > > myPost._x = 0; > > myPost._y = 0; > > trace ("myPost = " + myPost._x); > > } > > } > > > > In frame 1 of the movie i write: > > > > Post0 = new Post (); > > //Post0.setCord(100,100,0.9); > > Post0.attachMe(); > > > > The trace comes up 'undefined' > > if i use the 'attachmovie' from the root in the main time line, it works > > just fine. > > > > any clues? > > > > thanks! > > > > sebastian / amsterdam > > ___ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > -- Arul Prasad http://arulprasad.blogspot.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dynamically attaching a movie clip to a class/object
You are not defining what the movie should be attached to. Try: _root.attachMovie("signPost", "myPost", _root.getNextHighestDepth()); Note that I removed this.getNextHighestDepth(). Because "this" does not exist on the stage yet, you can not get its next highest depth. Charles P. On 4/26/07, sebastian chedal <[EMAIL PROTECTED]> wrote: > > hello flash coders! > > ive just joined and there are some nice discussions here, i hope to > contribute positivly to the level of knowledge in the group. > :) > > i'm currently learning how to work in an OOP manner in flash, and thus > meeting some basic hurdles. > it would be very kind of you if you could assist me in my [probably very > simple] problems. > :-) > > I'm using external *.as files, and at the moment i am trying to figure out > how to attach a movie to it [should be simple, right?] > > my as file: > > class Post extends CoreClass { > private var myPost:MovieClip; > > public function setCord(px,py,pz):Void { > > //set coordinates > public var px:Number = px; > public var py:Number = py; > public var pz:Number = pz; > //original point locations > private var ox:Number = px; > private var oy:Number = py; > private var oz:Number = pz; > } > > public function attachMe ():Void { > attachMovie("signPost", "myPost", this.getNextHighestDepth()); > myPost._x = 0; > myPost._y = 0; > trace ("myPost = " + myPost._x); > } > } > > In frame 1 of the movie i write: > > Post0 = new Post (); > //Post0.setCord(100,100,0.9); > Post0.attachMe(); > > The trace comes up 'undefined' > if i use the 'attachmovie' from the root in the main time line, it works > just fine. > > any clues? > > thanks! > > sebastian / amsterdam > ___ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] dynamically attaching a movie clip to a class/object
Either through library linkage or... import com.package.view.Main; yourMovieClip.__proto__ = Main.prototype; Main['apply'](yourMovieClip, null); - MaTT On 4/26/07, sebastian chedal <[EMAIL PROTECTED]> wrote: hello flash coders! ive just joined and there are some nice discussions here, i hope to contribute positivly to the level of knowledge in the group. :) i'm currently learning how to work in an OOP manner in flash, and thus meeting some basic hurdles. it would be very kind of you if you could assist me in my [probably very simple] problems. :-) I'm using external *.as files, and at the moment i am trying to figure out how to attach a movie to it [should be simple, right?] my as file: class Post extends CoreClass { private var myPost:MovieClip; public function setCord(px,py,pz):Void { //set coordinates public var px:Number = px; public var py:Number = py; public var pz:Number = pz; //original point locations private var ox:Number = px; private var oy:Number = py; private var oz:Number = pz; } public function attachMe ():Void { attachMovie("signPost", "myPost", this.getNextHighestDepth()); myPost._x = 0; myPost._y = 0; trace ("myPost = " + myPost._x); } } In frame 1 of the movie i write: Post0 = new Post (); //Post0.setCord(100,100,0.9); Post0.attachMe(); The trace comes up 'undefined' if i use the 'attachmovie' from the root in the main time line, it works just fine. any clues? thanks! sebastian / amsterdam ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] dynamically attaching a movie clip to a class/object
hello flash coders! ive just joined and there are some nice discussions here, i hope to contribute positivly to the level of knowledge in the group. :) i'm currently learning how to work in an OOP manner in flash, and thus meeting some basic hurdles. it would be very kind of you if you could assist me in my [probably very simple] problems. :-) I'm using external *.as files, and at the moment i am trying to figure out how to attach a movie to it [should be simple, right?] my as file: class Post extends CoreClass { private var myPost:MovieClip; public function setCord(px,py,pz):Void { //set coordinates public var px:Number = px; public var py:Number = py; public var pz:Number = pz; //original point locations private var ox:Number = px; private var oy:Number = py; private var oz:Number = pz; } public function attachMe ():Void { attachMovie("signPost", "myPost", this.getNextHighestDepth()); myPost._x = 0; myPost._y = 0; trace ("myPost = " + myPost._x); } } In frame 1 of the movie i write: Post0 = new Post (); //Post0.setCord(100,100,0.9); Post0.attachMe(); The trace comes up 'undefined' if i use the 'attachmovie' from the root in the main time line, it works just fine. any clues? thanks! sebastian / amsterdam ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com