Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Tutorial] Beginners - Creating Buttons
Index -> Graphics and Design, Web Design -> Flash MX Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheXploder




PostPosted: Sat Jan 24, 2004 2:56 pm   Post subject: [Tutorial] Beginners - Creating Buttons

In this tutorial you will learn:

code:

        1. create button instances.
        2. modify the created button instances.
        3. add simple script actions to the button instance.


Script actions such as the following:



    code:

    on ([mouseaction]) {
          // action
    }


    on is referred to mouseactions, when using mouseactions write them within the () and to start a column of code you need to open it
    with {, within that you can write the actions (consequences) for the mouseaction, and then close it with }.

    now to frame actions:
    code:
    gotoAndPlay([frame]);


    this, as it says "goes to a frame and plays it", the frame that it should go to you put within the ()

    stop actions:
    code:
    stop();

    this stops the program from playing the next frame.


Now the Main tutorial:

Create a new file, by clicking 'file', 'new' or pressing 'Ctrl' + 'n'

Make sure that your properties menu is visible, to make it visible click 'Ctrl' + 'F3'.

In the properties window modify the size of the background to 50 x 50 pixels.

From the toolbar select the oval tool or press 'o' and create an oval to make your oval even hold down the shift key.

Press the 'v' button and select the whole circular object you just created.
press 'F8' or click 'Insert', 'Convert to Symbol...' from the menu, this will bring up a window, and there set the behaviour to 'Button'.

Double click on your newly converted object. This opens up the editor for the object. Tweak your button around a bit, and add more frames if you like for the 'over', 'down', and 'hit' actions, and then return to the main scene by clicking 'Scene 1' or the 'Arrow Button' in the top left.

Click 'Insert', 'Layer' from the menu, and select the first frame of the newly created layer.

'F9' will bring up the actions window if it isn't already there.
Add this line of code:
code:
stop();


In Layer 1 'select' frame 2 and press 'F5' which creates a new frame, and then click 'Insert', 'Keyframe' from the menu.

In Layer 2 'select' frame 2 and press 'F5' and then click 'Insert', 'Keyframe' from the menu.

'select' the button object and add this code:

code:
on (release) {
        gotoAndPlay (2);
}


In Layer 1 select the second frame and hit delete.
In Layer 2 select the second frame and also add this code:
code:
stop();


To run it hit 'Ctrl' + 'Enter'.

And that's the end of this tutorial. Surprised



buttonTutorial.swf
 Description:
 Filesize:  1.16 KB
 Viewed:  2101 Time(s)




Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: Wed Feb 04, 2004 5:28 pm   Post subject: (No subject)

Nice tutorial... for the most part :S ... I kinda got confused... but at least your helping this section Smile good job
TheXploder




PostPosted: Thu Feb 05, 2004 5:44 pm   Post subject: (No subject)

How come, what was confusing?
Paul




PostPosted: Thu Feb 05, 2004 6:01 pm   Post subject: (No subject)

Im confuddled... cause of some of the hot keys... or perhaps this is because of some lack of punctuations. well, maybe its cause Im not doing it, I'll do it according to the tutorial now.

Oh yea, with the version I have, "convert to symbol" isnt on the instert menu, I have to select it and right click it to make "convert to symbol" option show.

Oh yea, maybe you should explain what those pieces of code does, cause for noobs like me who need the tutorial...
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> Flash MX Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: