Select movieclip class


i've got 'collection clip' linkage name 'clips'. contains 16 image clips linkage names (clip01 - clip16). mouse event read of 16 clicked through event.target.

 

var clipcollection:clips = new clips();

//

addchild(clipcollection);

scroller.source = clipcollection;

//

clipcollection.addeventlistener(mouseevent.click, personage);

function personage(event:mouseevent):void

{

  trace(event.target);

  //contentclip:movieclip = event.target

  //addchild(contentclip);

}

clicking on clip04 give example '[object clip04]'. have know linkage name, not instance name, since want load clip draggable movieclip through addchild.

 

now somehow have turn [object clip04] movieclip object can add stage through addchild(contentclip). i've commented lines since way did didn't work.

 

how can make clear 'contentclip' should linkage name of clip clicked?

use getqualifedclassname method of flash.utils

 

change trace(event.target); this:

 

trace(getqualifiedclassname(movieclip(event.target)));

 

that string "clip04". can use along getdefinitionbyname create new instance. example:

 

function personage(event:mouseevent):void

{

          var cname:string = getqualifiedclassname(movieclip(event.target));

          var myclass:class = getdefinitionbyname(cname) class;

          var classinstance:movieclip = new myclass movieclip;

          addchild(classinstance);

}



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account