Universal Button AS3 - actionscript-3

how can I make a button that works for all scene and frame even tho I skipped the code layer.
For an example,
Button A on Scene 1- Normal Button
Button B on Scene 2, Layer 1- Normal Button
Button C on Scene 2, All layer - Universal Button
Example - Click Button A to go to scene that Contain Button B and Button C. Button C will work if Button A go to the first layer that contain the code for the button C. But I make another button on the same scene with Button A, but the new button take the user to Scene 2 , layer 3, for an example, the C Button wont work anymore because it skipped the code. How can I do button that works for all scene and layer?

Related

Strange bug. AS3 button

Strange bug with every my button on stage.
When mouse over to my button - button go to frame 2.
When mouse click to button - button first go to frame 1, after to frame 3.
Button have right, full bounding box. My .fla document not have code. Just one button on stage. Previously, I had no such problem. It appears a few months ago ...
I would need to see your code for proof, but this is probably because of a bad event listener.
Check to make sure you're not listening for a MouseEvent.MOUSE_OVER. Listen for a MouseEvent.MOUSE_CLICK to handle your function properly.

Draggable menu containing non-draggable buttons with AIR

First off, I'm pretty novice when it comes to Flash and AS3.
I am trying to create a displayObject that contains 12 buttons for a mobile app. Since there are twelve buttons that will all open up into seperate menus they obviously all won't fit on a mobile devices screen. This is why I want to have all of the buttons on one display object that can be dragged up and down to show the buttons not currently displayed on the screen.
I am running into numerous problems while attempting this.
1) If I make the object containing the buttons draggable, which is behind the buttons, I can't click it through the buttons in order to drag it(unless I hit a sweet spot where there aren't any buttons but this isn't efficient for the user).
2) If I make the object containing the buttons draggable and put it in front of the buttons then I can't click the buttons in order to open the menus and access what is contained within them.
3) For some reason all of the buttons are seperately draggable when I don't want them to be. For example, I click anywhere on the screen (whether the touchID point is on a button or not) to move the entire list of buttons and if I happen to be clicking a button then, instead of moving the entire list, it moves that one button.
So the main question here is "How can I create a list of buttons and scroll through the list using a drag method (such as the settings menu on your phone) without dragging the buttons apart from each other." So the containing display object is draggable, and the buttons are clickable.
Some guy named Glenn does a good job with his example: http://rabidgadfly.com/2010/03/as3-clickable-button-inside-a-draggable-movie-clip/
However, if you click the yellow button in his example you can drag it out of the gray box. I want my button to remain stationary relative to the gray box. So you can move the gray box but the yellow button remains in the same location within the box but you cant drag the button around within the box.
I am not familiar with accelerometer events for the smartphones, but I do have an idea on how to fix this with regular actionscript 3 listeners. (You can just convert these to whatever is used by smartphone listeners)
A solution that comes to mind is to have a mouse down listener and a mouse up listener on the whole drag-able box. And when a mouse down event fires, you start a timer to go off in about a quarter of a second, and when it does you then set up a enter frame (or a timer based) function that fires every frame. This will update the whole box's position every frame corresponding to the current mouse location (your dragging box effect) and when the mouse up listener fires, it stops the dragging (and at this points, if the mouse is up, then the user is not touching the screen at all).
Also add a mouse click listener to every button. This way, with the quarter of a second timer, you KNOW that if the user simply wants to click a button, then they will click, leaving less that a quarter of a second between the mouse down and mouse up events (so that the dragging never starts) and the button is only clicked. And if the user holds the mouse down for more than a quarter of a second, then you KNOW that they must be trying to drag the whole thing.
This seams like the only way to differentiate between a user wanting to drag the box, and the user wanting to click a button inside it.
Obviously it does not have to be a quarter of a second, it can be any length of time that you want, it could even be no time at all, but then this might mess up things when people only want to click the button and accidentally slides it when clicking.
If you have any questions or problems, please comment and i'll try to help.

Actionscript 3: Simple Button

I am working on a project in which a button is clicked, and the frame jumps and stops at a certain area. The button I have is called cancelmenu_btn. It is spread over 1 keyframe (over 5 frames) on an actions layer. The coding for the back button is:
menuback_btn.addEventListener(MouseEvent.CLICK, menubackClick);
function menubackClick(event:MouseEvent):void{
gotoAndStop (2);
}
Yet, the back button only works on one of the frames - frame 3. I have a link to my project:
https://skydrive.live.com/embed?cid=9AB08B59DCCDF9C6&resid=9AB08B59DCCDF9C6%21110&authkey=ALkJwkJaKg7ypI0
What am I doing wrong with the menuback_btn?
There are a few things you have to check if you want the button active. First, make sure your code is on the first frame because it does not become active until that frame hits.
Second, make sure your button is also on the first frame, but then it will associate your btn.addEventListener(Function) correctly.

Flash buttons flicker continuously when compiled

I am looking for some help with Flash (CS5 version). I have a situation where if try to put a button on the stage with visible differences in the up/over/down/hit states, when I compile the document into a .swf, the button will continuously flicker through each state in order very quickly. Also, if I break the AS3 code in the Main class file, hidden parts of a slider bar component will flicker between visible and not. I'm talking Japanese-style, seizure-inducing flicker here. I've searched my code for recursive function calls and tried deleting and re-adding components and buttons, but to no avail. Any ideas on what could be up?
Well, it seems to me you aren't using stop() to stop the button at the frame you want.
If it isn't this, then there is some error with your ActionScript, which will show up in the output panel, so check that.
When you say 'button' is it an instance of the Button Class and have you set the instance type to Button?
i.e.
Select the button in your library panel, right click and choose 'Properties'. Then set the Type to Button.
Next, select the instance of the button on the stage, open the Properties panel and just underneath where you type the instance name you should see a drop down menu containing MovieClip, Button and Graphic. Set it to Button.

Tab key giving trouble. How can I stop this

I have a login MC on frame 1, layer 1. It contains 2 input texts username and password, and a login button. Beneath the login MC is menu MC (in frame 1, layer2). Menu MC contains a series of buttons (each button loads a child swf). When I publish and press tab key, the buttons located in menu MC also get selected, which I don't want. How can I stop this? What I want is so long as I have not logged in, I should not be able to select buttons on Menu MC by means of tab key. Very good site for SOLUTIONS. Whenever I face any programming problem, I turn to to stackoverflow. Thanks in advnce.
You can control whether a movieclip's children (or the movieclip itself) are selected when pressing tab with the tabChildren and tabEnabled properties. For example:
// disable selection of menu children with tab
menuMc.tabChildren = false;
Good luck.