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.
Related
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.
I have an element that fires some javascript on click.
Partially covering the element is a mostly-transparent graphic, which passes all events to that element. This way, regardless of if the overlay or the element is clicked, the element gets the events.
I'm trying to write a test in selenium that clicks the element under test and verifies the behavior, however the chrome webdriver tells me it can't click the element because the overlay will get the click event.
That is fine, though... How do I tell selenium that I don't care, to click anyways? I don't want to specifically click the overlay (in this test), the overlay is just eye-candy so the test should still work even if I remove the overlay.
edit:
To make clear... I want it to click in wherever it would have, if the overlay wasn't there. this way it'll click the element if there is no overlay, but click the overlay if covered.
You will not be able to click on the object under the overlay as Selenium has been written to only access what a user can access. If a manual user cannot click through then neither can Selenium.
You could either fire JavaScript directly on that object via the javascript_executor method, or alternatively, perform the interaction which will remove the overlay in your test
I could resolve this issue: In my application top header was visible and i clicked on one of the top elements (which was visible) and could continue with rest of the script execution
I solved this issue by clicking the coordinates of the close button.
Check out this answer. I showed how to click on the little "x" there, without needing to know the name of the actual button. Sometimes its easier to find the class of the image, for example.
Worst case, find the closest element to the button and change the last method to move_to_element_with_offset(element,x, y) to go from the element you found to the coordinates of the button on screen.
Once you do that, the overlay disappears and you can click as normal.
i want to put some effect to my screen, when it navigates to other page.
When i click a button in the first page it should navigate to second page.
i want some effect when navigate to second page, can anyone tell me how to do this?
check out the fl.transitions package in the ActionScript documentation. there are some ready-made transitions you can use (Fade, Fly, Wipe, etc.) or you can create your own with the Tween class.
I am trying to accomplish an "imagemap" in flash where you click on different areas in the image and when you click on it, a popup (within flash) comes up showing more information about the object that was clicked on. The popup has a close button that can will then close the popup.
My biggest trouble is the way I have my code right now is when you click on a region of the map, it creates a popup on the fly, and then I use addChild(_myPopup) to add it to the display list. The problem with this approach for me, is that the Popup is now a Child of the button I just pressed, but this object organization doesn't really make sense to me. I'd like to have the popup not be a child of the button and it be on it's own layer or a child of the stage directly.
What is a good approach and code architecture for building such an organization of objects? I'm fairly new to AS3 and I've built some small applications but my knowledge is limited.
Thanks
UPDATE
ok looks like calling stage.addChild(myPopup) from inside the button works pretty well. Is this good practice?
Assuming you have a hierarchy that looks something like this:
stage
Main class
Image class
Button
It's good practice to never call upwards in the displaylist, every object only deals with it's children. Events however, are a nice way of communicating upwards. Have the Button dispatch an event, preferrably a custom one, then handle that using a listener in the main class that then deals with creating a popup on top of everything.
An often encountered practise to organize the layers of the visible application is:
stage
main class with all children
popup container
tooltip container
mouse cursor container (apparently not longer necessary since player 10 supports custom cursors)
So you create your popups always in the popup container above the main class. If you would have tooltips, they should go into the tooltip container. This approach guarantees that popups are always visible above the main app and tooltips are always visible on top of everything.
I'm trying to create a top panel menu that contains 5 buttons.
I configured Up and Over state for each button.
how can I configure that one the button is clicked, the look of the button will change to the look i configured in Over state.
Each state contains a different image.
Is there a way to change the look of the button to the look it configured in it's different states using Action Script?
Using Flash CS4 Action Script 3.
thank you.
Something like this should work:
button.addEventListener(MouseEvent.CLICK, onButtonClick);
function onButtonClick(e:MouseEvent):void {
// Given you have a changeColor method defined in your button class
e.target.changeColor('#ff9900');
}
In the onClick event for the button you can change Up skin to be the same as the Over skin.
I resolved the issue by creating a MovieClip with two frames, one for with each button state,
and i just used gotoAndStop when needed to move to the required frame.
In each state I didn't need only to change color, but to the change the all visual presentation of the button.
it seems that i could not find any way to do that with a regular Button Object.
thanks.