Tuesday, December 21, 2010

Adobe flash CS5 -Actionscript 3.0 -Create a simple button-change color and add a link

1) Open Flash Professional CS5
2)  File ->New->ActionScript 3.0
3)  Insert -> New Symbol , select type button, click OK
4) You can see up, over, down  and hit in timeline
5) select up in timeline,  select Rectangle  tool (R) in Tools, draw a rectangle and fill with color light green.
Select T in Tools, type text Button with blue color in the same rectangle
6) Move to over in timeline, insert->timeline->keyframe, change text color red under right panel Properties and Character.
7) Move to down in timeline, insert->timeline->keyframe, change text color pink under right panel Properties and Character.
8) Move to hit in timeline, insert->timeline->keyframe, change text color to other collor under right panel Properties and Character.
9)choose Edit > Edit Document to exit Symbol Edit mode.
Drag the button symbol out of the Library onto the Stage.
10) click  button, under property  fill  myButton_btn
 11) click outside button, press F9, type following code
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
myButton_btn.addEventListener(MouseEvent.CLICK, onMouseClick);
function onMouseClick(event:MouseEvent):void
{
   var request:URLRequest = new URLRequest("http://www.youtube.com/v/1HwgUP6FuaU");
   request.method = URLRequestMethod.GET;
   var target:String = "_blank";
   navigateToURL(request, target);
}
12) Control->Test Movie->in Flash Professional or (Ctrl enter)
you can watch swf file
13) File->Export->Export Movie, save as mybutton1.swf
14) My result: (click to link to other page)

4 comments:

  1. Flash Drop Down Menu Tutorial with Actionscript 3.0
    http://www.youtube.com/v/LC7BaZCForE

    ReplyDelete
  2. Other tutorials can be found:
    http://www.tutvid.com/tutorials/

    ReplyDelete
  3. [CSS] Build a Simple Web Page in Dreamweaver!
    http://www.youtube.com/v/hBWiS6soZfs

    ReplyDelete
  4. flash tutorial:
    http://www.youtube.com/user/LilredheadComics#g/u

    ReplyDelete