Be a Supporter!

attachMovie() problem

  • 257 Views
  • 5 Replies
New Topic Respond to this Topic
Stilianos
Stilianos
  • Member since: Aug. 10, 2007
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
attachMovie() problem 2009-03-09 05:40:51 Reply

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
Response to attachMovie() problem 2009-03-09 06:15:25 Reply

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.
Forum Stats
Member
Level 46
Blank Slate
Response to attachMovie() problem 2009-03-09 06:22:29 Reply

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;
}

- - Flash - Music - Images - -

BBS Signature
Stilianos
Stilianos
  • Member since: Aug. 10, 2007
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to attachMovie() problem 2009-03-09 06:29:03 Reply

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.
Forum Stats
Member
Level 46
Blank Slate
Response to attachMovie() problem 2009-03-09 09:39:32 Reply

on (press) {
	i++;
	nmc=this.attachMovie("Squirrel","Squirrel"+i,_root.getNextHighestDepth());
	nmc.onEnterFrame=function(){
		//DO STUFF
	}
}

- - Flash - Music - Images - -

BBS Signature
Stilianos
Stilianos
  • Member since: Aug. 10, 2007
  • Offline.
Forum Stats
Member
Level 02
Blank Slate
Response to attachMovie() problem 2009-03-10 00:53:07 Reply

And that sir is why they call you the master of the flash forum