currentFrame of nested element as variable for a function


hello,

 

i need address nested movieclip called dlmcx, lying on frame x of movieclip called maincontainer.

 

i tried following:

 

by tracing gives out right code didn't manage implement simple gotoandplay function.

 

function whichframe(event:event):void {

trace("maincontainer.dlmc" + maincontainer.currentframe);

var str:string = new string("maincontainer.dlmc" + maincontainer.currentframe);

}

maincontainer.addeventlistener(event.enter_frame, whichframe);

 

var str:string = new string("maincontainer.dlmc" + maincontainer.currentframe);

 

steuerung.replay.addeventlistener(mouseevent.click, fl_clicktogotoandstopatframe_7);

function fl_clicktogotoandstopatframe_7(event:mouseevent):void

{

_root[str].gotoandplay(2);

}

 

 

i tried

root[str].gotoandplay(2);

[str].gotoandplay(2);

and more.

 

 

i tried simpler method one:

 

 

steuerung.replay.addeventlistener(mouseevent.click, fl_clicktogotoandstopatframe_7);

function fl_clicktogotoandstopatframe_7(event:mouseevent):void

{

  maincontainer.("dlmc" + maincontainer.currentframe).gotoandplay(2);

}

 

 

but don't work.

 

any great.

thank in advance.

 

felix

when using bracket notation target something, each bracket limited 1 object.  in first attempt need have each string in separate set of brackets.  in secomd attempt did not try using bracket notation , not sure tried, correct form of be...

 

maincontainer["dlmc" + string(maincontainer.currentframe)].gotoandplay(2);



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support