attachMovie() problem
- Stilianos
-
Stilianos
- Member since: Aug. 10, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
I recently learned how to use the attachMovie() command and was wondering how i would go about adding script to the movieclips I create?
Thanks in advance :)
- Stilianos
-
Stilianos
- Member since: Aug. 10, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
Sorry i guess I need to explain a little better;
on (press) {
i = i+1;
this.attachMovie("Squirrel", "Squirrel"+1, _root.getNextHighestDepth());
}
I would like it so that when this movieClip is created to already has a script built into it.
Something like
on (press) {
i = i+1;
this.attachMovie("Linkagename", "NewInstance"+1, Depth(), {X,Y}, InputScriptHereForWhenLoaded );
}
Thanks in advance
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
Either
on (press) {
i++;
this.attachMovie("Squirrel", "Squirrel"+i, _root.getNextHighestDepth(), {_x:300,_y:300});
}
or
on (press) {
i++;
nmc=this.attachMovie("Squirrel", "Squirrel"+i, _root.getNextHighestDepth());
nmc._x=300;nmc._y=300;
} - Stilianos
-
Stilianos
- Member since: Aug. 10, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
At 3/9/09 06:22 AM, Denvish wrote: Either
on (press) {
i++;
this.attachMovie("Squirrel", "Squirrel"+i, _root.getNextHighestDepth(), {_x:300,_y:300});
}
or
on (press) {
i++;
nmc=this.attachMovie("Squirrel", "Squirrel"+i, _root.getNextHighestDepth());
nmc._x=300;nmc._y=300;
}
I'm sorry but i think you misunderstood me
for a more detailed example
on (press) {
i = i+1;
this.attachMovie("Squirrel", "Squirrel"+1, _root.getNextHighestDepth()
onClipEvent(enterFrame){
Movie clip code that will be in the movieClip once it has been attached and will run immediately once the movie is attached.
}
);
}
Does that clear up what i am trying to say?
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
on (press) {
i++;
nmc=this.attachMovie("Squirrel","Squirrel"+i,_root.getNextHighestDepth());
nmc.onEnterFrame=function(){
//DO STUFF
}
} - Stilianos
-
Stilianos
- Member since: Aug. 10, 2007
- Offline.
-
- Forum Stats
- Member
- Level 02
- Blank Slate
And that sir is why they call you the master of the flash forum


