Giving a movie clip instance name?

Movie clip was loaded by script

Page 1 of 1

4 Replies - 3985 Views - Last Post: 01 October 2009 - 06:16 AM

#1 brizick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-March 09

Giving a movie clip instance name?

Posted 30 September 2009 - 12:15 PM

i wandering how to give a movie clip an instance name...
the movie clip was loaded by script.. here is the script..

public function loadMap(_mapName:String) {
			var mapClassName:Class=getDefinitionByName(_mapName) as Class;
			var mapMovieClip:MovieClip=new mapClassName as MovieClip;
			this.addChild(mapMovieClip);
			examineMap(mapMovieClip);
		}



when i call a function
loadmap("Town");
script was working great if examineMap function is not called
then when it goes to examineMap function

public function examineMap(_mapMC:MovieClip) {
			var mapMC:MovieClip = _mapMC;
			for (var i:int=0; i<this.mapMC.numChildren; i++) {
						//statement
					   }
}



that code returned an error
TypeError: Error #1010: A term is undefined and has no properties.

but if i dragged Town Class from library and give it an instance name (ie:townMap) and change the examineMap script like
public function examineMap(_mapMC:MovieClip) {
			for (var i:int=0; i<this.townMap.numChildren; i++) {
						//statement
					   }
}


all code working properly

i've trace mapMC it was an Object Town

i wonder how to give a MovieClip that loaded by script an instanceName so i can access at examineMap function

This post has been edited by brizick: 30 September 2009 - 10:29 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Giving a movie clip instance name?

#2 brizick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-March 09

Re: Giving a movie clip instance name?

Posted 30 September 2009 - 12:15 PM

unsolved yet... anyone know how?

This post has been edited by brizick: 30 September 2009 - 10:27 PM

Was This Post Helpful? 0
  • +
  • -

#3 brizick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-March 09

Re: Giving a movie clip instance name?

Posted 30 September 2009 - 05:52 PM

double post
Was This Post Helpful? 0
  • +
  • -

#4 thehat  Icon User is offline

  • awake ? web();
  • member icon

Reputation: 106
  • View blog
  • Posts: 951
  • Joined: 28-February 08

Re: Giving a movie clip instance name?

Posted 01 October 2009 - 03:21 AM

What happens if you take away the 'this'?
for (var i:int=0; i<mapMC.numChildren; i++) {


Was This Post Helpful? 1
  • +
  • -

#5 brizick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 09-March 09

Re: Giving a movie clip instance name?

Posted 01 October 2009 - 06:16 AM

View Postthehat, on 1 Oct, 2009 - 02:21 AM, said:

What happens if you take away the 'this'?
for (var i:int=0; i<mapMC.numChildren; i++) {



O MY GOD... why i didn't think about that... it works!!
thank you very much buddy :^: :^: :^:
i will wrote your id in my thanks list later :D :D
BIG THANKS FROM ME
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1