Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Button Help

New Here ,
Apr 29, 2013 Apr 29, 2013

I need help writing the code for a button that will switch the current scene.

-I want the button to be activated by the spacebar

-when the button is activated it will automatically switch the scene to another scene playing simoutaenously

-if the button isnt activated after 5 seconds it will dissapear

Could someone give me an example of what this code will look like. I am a beginner to Actionscript with very limited knowledge of coding, I appreciate all help thank you.

TOPICS
ActionScript
1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2013 Apr 29, 2013

it's not clear what you mean by, "..the button to be activated by the spacebar".

clicking the button (with the mouse) could trigger a scene change or pressing the spacebar could trigger a scene change.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2013 Apr 30, 2013

Sorry let me make myself clearer.

I want to have a video clip playing and at a specific frame I want a button to appear on the screen, only the spacebar can activate this button nothing else.

When this button is activated it will switch the video clip to another one playing simultaneously.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2013 Apr 30, 2013

what purpose does the button serve?  does it need to be clicked?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2013 Apr 30, 2013

Only the spacebar can activate this button nothing else.

When this button is activated it will switch the video clip to another one playing simultaneously.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2013 Apr 30, 2013

just use a keyboardevent listener.  the button appears to be irrelevant.

this.addEventListener(KeyboardEvent.KEY_DOWN,keydownF);

function keydownF(e:KeyboardEvent):void{

this.gotoAndPlay("framelabelornumber","scene name");

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2013 Apr 30, 2013

Thanks alot this is really helpful I have another question.

What is the process in Flash to having two video clips playing simultaneously, when this button is activated the video clips will switch instantly and continue playing

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2013 Apr 30, 2013

Sorry I also frogot to mention the button only appears if you want to switch the video clip, if you dont actiavte the button after a few seconds it will dissapear and the original clip will continue playing.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2013 Apr 30, 2013

use two flvplayback components to play two videos simultaneously.

your button serves no purpose (that you've been able to explain so don't use it).

when the keydownF executes, you can change the source properties for the flvplayback components (to change the videos they play) without needing to change frame.

use a timer to trigger an event that will occur after a certain period of time.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2013 Apr 30, 2013

The purpose of the visible button is to give the person watching an option to switch between "video 1 and 2"

The button will only appear for a few seconds and if it isnt activated it will dissapear. Only during that time period will you have the option to switch between videos.

How do I insert two flvplayback components in flash? Do they each go on seperate layers or seperate scenes?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2013 May 01, 2013
LATEST

just place two of them on stage.  they can be in the same layer/same frame or different layers.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines