views:

54

answers:

1

i've a button called profile_btn i want to make this code by OOP

profile_btn.addEventListener(MouseEvent.CLICK,profile_btnClickHandler);
function profile_btnClickHandler(ev:MouseEvent):void
{
    //The actual code to jump to a specific frame
    this.gotoAndPlay('play');
}

another question how to include 3 classes to a specific frame by actionscript3 n't related to any object

A: 

The following can be used if you have a class (the name you specified in linkage) profile_btn.

var myButton:profile_btn =new profile_btn()

If your want to add it to stage use:

stage.addChild(myButton);

So you code might look as

var myButton:profile_btn =new profile_btn()

stage.addChild(myButton);

myButton.addEventListener(MouseEvent.CLICK,profile_btnClickHandler);

function profile_btnClickHandler(ev:MouseEvent):void
{
    //The actual code to jump to a specific frame
    this.gotoAndPlay('play');
}
loxxy
i get this error Error: Error #1023: Stack overflow occurred. at flash.display::MovieClip/get currentScene() at fl.motion::AnimatorBase/handleEnterFrame() at btn_profile()
Maged
and how to include this class in a specific frame by actionscript3
Maged
loxxy
I copy this code without editing and it's work without errors but the btn doesn't appear ,
Maged
and if i want to make it appear in a specific frame how can i make it , note the button in the library i didn't put it in the stage as i use addChild method
Maged
thanks for your help
Maged
loxxy
how can i call a class in a specific frame ????????
Maged
select a frame, open the as panel, call the class like " var ObjectName: ClassName = new ClassName(); "
loxxy
thanks again ,,
Maged