If / Then for Buttons to go to Frame Labels?
Hello.
I'm asking for some hand-holding on this one. Hopefully I can explain this well enough.
I have a complex button that when rolled over the playhead goes to Frame Label textOut.
When a roll out is executed, the playhead is to go the Frame Label textIn.
Easy enough.
mcBtnHome1.addEventListener(MouseEvent.ROLL_OVER, dropText);
function dropText (evt:MouseEvent): void
mcBtnHome1.gotoAndPlay("textOut");
mcBtnHome1.addEventListener(MouseEvent.ROLL_OUT, raiseText);
function raiseText (evt:MouseEvent): void
mcBtnHome1.gotoAndStop("textIn");
mcBtnHome1.addEventListener(MouseEvent.CLICK, landHome);
function landHome (evt:MouseEvent): void
mcBtnHome1.gotoAndStop("textStay");
The problem occurs when I plug in the third event, the click. I click the button, and the playhead moves to Frame Label textStay, as it's supposed to, but once I roll out/ off of the button, the roll out action is again executed. Once I click on the button, no more interaction is supposed to be possible.
This happens despite my having a stop(); action at the textStay frame.
I'm guessing I need an if / then of if / else statements, with some true / false declarations, but I've no clue as to what "if's" I should be checking for.
In your click function you could remove the ROLL_OUT listener, and then reassign it when you get to your textStay frame.
(Edit - actually, you probably want to assign that ROLL_OUT listener in the ROLL_OVER function at all times)
mcBtnHome1.addEventListener(MouseEvent.ROLL_OVER, dropText);
function dropText (evt:MouseEvent): void {
mcBtnHome1.addEventListener(MouseEvent.ROLL_OUT, raiseText);
mcBtnHome1.gotoAndPlay("textOut");
function raiseText (evt:MouseEvent): void {
mcBtnHome1.gotoAndStop("textIn");
mcBtnHome1.addEventListener(MouseEvent.CLICK, landHome);
function landHome (evt:MouseEvent): void {
mcBtnHome1.removeEventListener(MouseEvent.ROLL_OUT, raiseText);
mcBtnHome1.gotoAndStop("textStay");
Similar Messages
-
Creating new buttons on different frame labels
can someone tell me if im doing something wrong or assigning
the as to the wrong frame?
first off i have all my buttons on frame 2. im creating a
real estate site and i have to have a couple links like HOME ABOUT
BUYING SELLING CONTACT, the thing though is that in the BUYING and
SELLING frames i want to add more sections and links but only on
these 2 other parts of my site. when i code it and add new buttons
to these sections though my movie plays over and over and over non
stop. heres my coding...
FRAME 1 preloader
Frame 2 has a frame label of home and all the buttons on a
diff layer, and AS3 on a different layer
Frame 3 has a frame label for about section
Frame 4 is my contact for example
so if i create a new button in the about frame label and just
add the code to the working as3 code on frame 2 my movie just plays
over and over and over again, and all i want it do do is act like
the other buttons and go to a different frame label down in the
time line. the only way i get it to work is if i have ALL my
buttons on frame 2.
frame 1
my preloader
frame2
home_btn.addEventListener(MouseEvent.CLICK, onHome)
function onHome(event.MouseEvent):void
gotoAndStop("home");
about_btn.addEventListener(MouseEvent.CLICK, onAbout)
function onAbout(event.MouseEvent):void
gotoAndStop("about");
etc....
etc...
i enter my btn code just like this and the buttons on frame 2
work but any new buttons i try and creat and put into different
frames othere then frame label "home" aka frame 2 wont workcorrect.
there are lots of ways around it. but they all require the
object to exist when the code executes.
with as3 it's particularly easy to create objects, code for
them and then add them to the display list later when
needed. -
I have an FLA with two scenes. The first scene is an
opening...at the end it goes to the next scene called Main.
On Main I have a series of buttons....that click to different
frame labels in Main.
When I play JUST the scene it works fine...but when it goes
from the opening into Main...I get this error on all the buttons:
ArgumentError: Error #2109: Frame label Board not found in
scene Main.
at flash.display::MovieClip/gotoAndPlay()
at ASIS4_fla::MainTimeline/onMouseClickBoard()
There is a label called Board...and it works with that scene
alone...any idea why it doesn't work when coming off the previous
scene.
Thank you in advance...this is on the first frame of the scene...when I do test
Scene...it works great. But Test Movie I get that error
btn_boardcert.addEventListener(MouseEvent.CLICK,
onMouseClickBoard);
function onMouseClickBoard(event:MouseEvent):void
gotoAndPlay("Board"); -
My iphone keeps blanking out and then when I press then home button it tells me the battery is dead. it has happened to me at 30%, but today it was at 71%, is there a fix for this?
This is often due to faulty battery. Make Genius reservation and take iPhone to Apple Store for free quick battery diagnostic testing.
-
In Logic, Pro or Pro X Meta Events don't work correctly; for example inserting Stop Playback number 52 in a specific position the playhead stops wrongly several ticks before. Then the button play does not start.
Curious if what your describing is similar to issue 4 which starts around 9:15 in video...
https://youtu.be/q93jdOhi4Oc
If so this started for me, or at least I noticed it for the first time in LPX 10.1.1. What version of logic are you running?
I've recently found that this issue also affects note timing on instrument tracks that use the "External Instrument" plugin. -
Code for button located inside the MC
I decided to rearange my flash site and now things don't work.
I used to have an image collage where all the images were buttons and each image was located on the stage ( which made a stage with 10+ loose images)
I made each image a button. Below is a code example for one of the images named "icysophistication_app_btn". The previously working code for it was:
icysophistication_app_btn.addEventListener(MouseEvent.CLICK, onClick_IcySophisticationPopUp);
function onClick_IcySophisticationPopUp(event:MouseEvent) :void {
gotoAndPlay("icysophistication");
Then I decided to unite all the images into one mc called "imgscollage_buttons_mc" (because later on I want to build another collage and have them sliding on the screen with tweener engine)
imgscollage_buttons_mc.icysophistication_app_btn.addEventListener(MouseEvent.CLICK, onClick_IcySophisticationPopUp);
function onClick_IcySophisticationPopUp(event:MouseEvent) :void {
gotoAndPlay("icysophistication");
I am guessing I have to put something before - gotoAndPlay("icysophistication");
but can't figure out what.
Please suggestyour original code was on the main timeline and it was the main timeline that contained the frame labeled "icysophistication"?
your new code is still on the main timeline and the main timeline still has that frame label? -
"previous" button to the last frame of a MC
I have a question that I hope will be super easy - I just
can't see to find it. Also, flash is not my main app but I'm trying
to pick up on some work that someone else had started. Here is the
breakdown - in the main timeline there are a series of projects
(frames labeled "projA, projB, etc). If you open up each project
movie clip (say projB) it opens up a slide carousel-like interface
(frame1=image1, frame2=image2, etc). The next button says
"onRelease go to frame 2" and so on. When we get to the last frame
in projB, the NEXT button says go to the root and play projC. This
allows the end users to just hit NEXT the whole time and work their
way through the presentation.
Where I'm a bit stuck is on the PREVIOS button frame of
projB. I would like it to go to the LAST frame of ProjA but the
best I can do is to make it go back to the begining of Proj A
on(release){
_root.gotoAndPlay("projA");
Is there a way to make it go to say, frame 4 of projA? Or
better yet, just the "last" frame of projA? I know this is probably
not the ideal way to set up the file, but i inherited the
presentation from my co-worker. Any suggestions on how to make the
PREV button work a bit better?you might be able to accomplish this through the use of a
variable, although it will be tricky in the scenario you describe.
declare a new variable on frame one main timeline, let's say
'back':
var back:Boolean;
then on the frame label for each project you will use a
condition to see if 'back' is true - if so, then use the condition
to nav to the last frame of the project clip - something like:
if(back) {
back = false;
projA.gotoAndStop(projA._totalFrames);
this would belong on the main timeline, so in your previous
button's 'on' handler add a statement to set 'back' to true so that
the condition fires. and navigates to the last frame of the proj
clip, as in:
on(release){
_root.back = true;
_root.gotoAndPlay("projA");
repeat this procedure for all project frames and buttons
replacing the MC instances with the corresponding names. -
How to place a button anywhere in a frame ?
I'd like to place a button anywhere in a frame for example at the coordonates (10, 10) without specifying the type of th layout. (I work with jdk1.2 and j2sdk1.4)
I used setLayout(null) and then btn.setLocation(10, 10) with btn the name of the button.
The problem is that the button is not displayed in the frame so could you give the solution for that ?
Thanks !try this code to add button anywhere on frame
watch for function setbounds()
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NoLayout extends Frame{
static Container c1 = new Container();
public NoLayout(){
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e){
dispose();
c1.setLayout(null);
JPanel p1 = new JPanel();
c1.add(p1);
JButton b1 = new JButton();
b1.setBounds(50,50,100,50);
b1.setText("ABCD");
c1.add(b1);
public static void main(String [] args)
NoLayout f1 = new NoLayout();
f1.add(c1);
f1.setTitle("My Program");
f1.setBounds(0,0,400,400);
f1.setVisible(true);
hope it helps
bye -
Somebody please help:
I've taught myself enough with Flash to customize a
fully-Flash template for my wife's website, and two of the buttons
didn't do what I wanted them to in Actionscript. They then began
giving me the message:
**Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line 1:
Mouse events are permitted only for button instances
on (rollOver) {
**Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line 4:
Mouse events are permitted only for button instances
on (releaseOutside, rollOut) {
Total ActionScript Errors: 2 Reported Errors: 2
Not only do I not know how to fix this, the same message
comes up for every single button in the entire fla I had saved,
plus earlier versions where I hadn't even messed with the buttons
yet.
Any suggestions?Hello Corbett,
The error is saying that you are trying to apply a button
action to something
other than a button. Often this happens when you select the
frame that the
button is on instead of the actual button, thus applying the
action to the
frame instead of the button.
Make sure you select the button on the stage and then apply
the actions there.
You'll probably have to remove the action from the frame
before it will work
(looks like it's on Layer 4 frame 1).
Good luck!
Jesse H.
Adobe Community Expert
My site:
http://www.jharding.com
Free Blog Radio:
http://www.tornadostream.com
> Somebody please help:
> I've taught myself enough with Flash to customize a
fully-Flash
> template for
> my wife's website, and two of the buttons didn't do what
I wanted them
> to in
> Actionscript. They then began giving me the message:
>
> **Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line
1: Mouse
> events are
> permitted only for button instances
> on (rollOver) {
> **Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line
4: Mouse
> events are
> permitted only for button instances
> on (releaseOutside, rollOut) {
> Total ActionScript Errors: 2 Reported Errors: 2
>
> Not only do I not know how to fix this, the same message
comes up for
> every
> single button in the entire fla I had saved, plus
earlier versions
> where I
> hadn't even messed with the buttons yet.
> Any suggestions? -
How to find function code for buttons on toolbar in oops alv
Hi experts,
I want to remove some buttons from toolbar in oops alv, i know the procedure like get function code and pass the value in a table and pass that table to IT_TOOLBAR_EXCLUDING of
method set_table_for_first_display but I WANT TO KNOW HOW TO FIND FUNCTION CODE FOR BUTTONS ON TOOLBAR IN OOPS ALVHi Prakash,
-->First you have to set the pf status in your alv program by,
{FORM pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'FIRST'.
ENDFORM. "PF_STATUS}
-->Pass this Subroutine name in the Function module, Reuse_alv_grid_display's parameters i.e,
i_callback_pf_status_set = 'PF_STATUS'}
*-->Then doble click on that pf status,
From the menu bar, select Extras->Adjust Template->List Viewer,
This will give you the existing statndard gui status of the program*
->Then catch that function codes in the User command Parameter of the Function module Reuse.. i.e,
i_callback_user_command = 'COMM'
And make a subroutine of the name 'COMM'i.e,
FORM comm USING ucomm LIKE sy-ucomm selfield TYPE slis_selfield.
DATA: okcode TYPE sy-ucomm.
okcode = ucomm.
CASE okcode.
WHEN 'REF'.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'MANSI'
txt1 = 'CREATED BY'
txt2 = SY-UNAME
TXT3 = ' '
TXT4 = ' '
endcase.
Hope it helps you
Regrds
Mansi -
I have clicked on hide inside bookmarks button then bookmarks button in the toolbar disappeared , How can I get it back ?
Hiding the Bookmarks menu item is not a default feature in Firefox.
Do you have a Delicious extension installed? <br />
If so, look for that option in that extensions options. <br />
If not, look at the extension s that you ''do'' have installed for that preference. -
Greater then 18 Buttons in 16:9 menu!!!! HELP
Hi,
I need to get more then 18 buttons into a 16:9 motion menu.
Currently running DVD Studio Pro 2.0.5
Can this be done in newer versions of DVD Studio Pro, or is it a limit of the DVD programing code??
Thanks for your help
NeilYou need to know why, the DVD spec is 32 buttons per menu, but in 16x9 it's half of it, 16 for widescreen, 16 for letterbox, here you go, limitation is the key of good DVD production!!!!! DVD spec is your worth nightmare!!!!!! There is a solution for that mind you (like headach pills), commitment!!! sounds like something else already!!! :0)
PJ -
Can you have a button play a specific frame in a different Edge Animate page?
I'd like to create a movie that can open other HTML files and go to a specific frame within those other pages. Is there any way to handle that inside of Edge Animate?
Thanks for the suggestion, but I'm looking for something a little different.
I'm looking to figure out a way to pass along some information from one movie to another.
For example. If I have a page (Movie1.html) that has Button A, Button B and Button C. Is there a way for me to open a different page (Movie2.html) AND point to a different frame based on what they clicked in Movie1.html?
So if they click Button A, it will open Movie2.html and go to frame label "IntroSection"
But if they click Button B, it will still open up Movie2.html, but this time it would jump to the label "AboutUs"
And if they click Button C, it will open up Movie2.html, it would jump to the label "End"
The idea is to have a few different files, but be able to point to specific frames or labels within an external movie.
Thanks!
Jeff -
[svn:fx-trunk] 11602: Fix for Button tooltips.
Revision: 11602
Author: [email protected]
Date: 2009-11-09 22:35:11 -0800 (Mon, 09 Nov 2009)
Log Message:
Fix for Button tooltips. TextBase dispatches an event when _isTruncated is set through the setIsTruncated() function. This allows ButtonBase to listen for the event and set the tooltip as necessary. If an explicit tooltip is set, then ButtonBase will not set a tooltip.
QE notes: No
Doc notes: No
Bugs: SDK-22260, SDK-23474, SDK-23657
Reviewer: Evtim
Tests run: checkintests
Is noteworthy for integration: No
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-22260
http://bugs.adobe.com/jira/browse/SDK-23474
http://bugs.adobe.com/jira/browse/SDK-23657
Modified Paths:
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Label.as
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RichText.as
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.a s
flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as -
Code for button is affecting the entire movie
The following code is on the timeline and the button
instance, cancelMC, is also on the same timeline in a different
layer and appears 4 times throughout the timeline. I've asked this
question (worded differently) at kirupa and the post has gone
ignored for some reason - maybe the title is too long or something.
The code tells the button, onRelease, to "gotoAndStop(1)" however,
if you click anywhere on the interface it does that. This is what
would have happened if I had put on the timeline
"this.gotoAndStop(1)." But I did not type that as you can see:
with(cancelMC){
onRollOver = function(){
this.ExplainMC.gotoAndStop("cancel");
onRollOut = function(){
this.ExplainMC.gotoAndStop("void");
onRelease = onReleaseOutside = function(){
_root.searchPanelMC.mainMenuMC.gotoAndStop(1);
this.gotoAndStop("user");
Notice it says "this.cancelMC"? That is the button. Someone
please help with this - I am at a loss and have tried everything to
make it work.your original code was on the main timeline and it was the main timeline that contained the frame labeled "icysophistication"?
your new code is still on the main timeline and the main timeline still has that frame label?
Maybe you are looking for
-
I can't connect to a web site via the site's own WiFi.
This is a strange one. When I'm in the New York Public Library and connected to the internet via their WiFi I can connect to any web site EXCEPT the New York Public Library's! (www.nypl.org) It tries connecting then times out every time. I can connec
-
I'm using Acrobat Standard 8.1.0. I would like to run from Excel VBA a process to convert PDF files into TXT files. The same affect of opening the files in Acrobat and clicking on Save As and changing the filetype to .txt. I've looked through the onl
-
Why does my cursor spin?
I just got a new MacBookPro, and I recently downloaded pages and number and keynote but even when nothing is downloading my cusor is a rainbow circle and it spins. I cant move anything on the desktop or open anthing on the desktop, and I am not reall
-
CS Extension Check In event for InDesign and Illustrator
Hi, For CS6 InDesign Similar to DocumentEvent.BEFOR_SAVE, do we have anything for check in event as well, I am using cs 1.5 sdk. If that is not available, how we can implement such a functionality. Do we have to use Indesign SDK or are there any alte
-
How to reset the PowerBook, delete the existing account, and create new user ? Don't know the password