FORUMS: list search recent posts

Adding actions on BUttons using AS3

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Manny Rellesiva
Adding actions on BUttons using AS3
on Jul 8, 2010 at 10:55:50 am


my problem is the navigation in my movie. I usually used buttons and I used AS 2.0 where I attached the actions directly to the button. Howwever, I have video menus. Im using FLVPlayback component on Flash CS4.What I want to accomplish is after each video plays, a check mark will be placed beside it. I have no problem with that i've done it with AS 3.0. I have the following codes:

import fl.video.VideoEvent;

check1.visible=false;

myVideo.addEventListener (VideoEvent.COMPLETE, showCheck);

function showCheck(event:Event): void {
check1.visible=true;
}

Im not used of of using AS 3.0 on buttons. Is there a way to use AS 2.0 but I will still accomplish the same thing with the video menus?


If ever I have no choice but to choose AS 3.0, I tried AS3.0 on button navigation such as this:

stop();
import flash.events.MouseEvent;
My_btn.addEventListener(MouseEvent.CLICK, CursorClick);

function CursorClick(event:MouseEvent):void{
gotoAndStop("2");
}

The above codes work fine. I have the action on the first frame of my movie. However. I have several buttons which appeared on the 10th, 20th, etc...frame. I have named the instances of my buttons. SHould I placed all the instances of my buttons on the first frame of my timeline even though they're not yet appearing on the stage? I received errors during runtime when I do this.

stop();
import flash.events.MouseEvent;
My_btn.addEventListener(MouseEvent.CLICK, CursorClick);

function CursorClick(event:MouseEvent):void{
gotoAndStop(2);
}

My_btn2.addEventListener(MouseEvent.CLICK, performTask);

function performTask(event:MouseEvent):void{
gotoAndStop(10);
}

My_btn3.addEventListener(MouseEvent.CLICK, bigCircle);

function bigCircle(event:MouseEvent):void{
gotoAndStop(20);
}

etc....


the rest of the buttons(My_btn2, My_btn2, etc...) keyframe are not in frame1. Am I doing somthing wrong? any advice? thansk in advance...


manny


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]