A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Converting button code...

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    3

    Unhappy Converting button code...

    Hello,

    I have made few simple websites with as2 and this is the function I used for the buttons so it goes and shows the animation for each page. Now I want to use the same function on AS3 but is not working. Can someone help me to convert it or just show me how it works on AS3.

    Thanks!

    This is the code for AS2:


    on(release){
    _root.play();
    _root.choose="46";
    }

  2. #2
    Senior Member
    Join Date
    Jul 2006
    Location
    San Jose, CA
    Posts
    334
    I (Love | Hate) Flash.
    ----
    Save a version back so others may help you!

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    3

    Converting button code...

    How is this gona help me to ROLL_OUT the page I am on when i click on different one?

    Here is an example what i mean by rolling out effect when i click on different button.

    www.7chudesa.tk

  4. #4
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    that second post is confusing - in the first you're asking about on(release) in AS3 - then in the follow up you start talking about ROLL_OUT and show that link that doesn't really show much.

    to answer the original question: you can't put script on objects anymore - it has to be in a class or in the frame.

    assuming the button's on the main timeline, you'd first have to give it an instance name (i'll use "myButton" for this example). you'd also have to have "choose" defined in the timeline and can't just assign it on the fly like you could in AS2. then you add an event listener, and a function to handle the event:
    PHP Code:
    var choose:String;
    function 
    clickHandler(event:Event):void{
      
    play();
      
    choose "46";
    }
    myButton.addEventListener("click"clickHandler); 

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    3

    resolved

    moagrius thank you very much! It works!
    I was looking for that all day I know about functions and some other things and how to structure it is just that I don't know key things on AS3 like this one. I could of make it without this effect but then the website is gonna look crap and I don`t want this.

    Thank you!



  6. #6
    ___________________
    Join Date
    May 2004
    Posts
    3,174

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center