Questions

Answer

How to use events

First, make sure the product you want to use dispatches events. You'll find this specified in the install instructions for Flash from the product's page.

Open your existing Flash project and drag the desired component on your stage.

Make sure the component is selected and give it an instance name, e.g. component. Keep in mind that you have to use the same instance name in the actions panel as well.

Open the actions panel and paste the following code:

component.addEventListener("itemRollOver", itemRollOverHandler);
component.addEventListener("itemRollOut", itemRollOutHandler);
component.addEventListener("itemClick", itemClickHandler);

function itemRollOverHandler(e:Event):void {
trace("you rolled over item" + e.currentTarget.focusedItem);
}

function itemRollOutHandler(e:Event):void {
trace("you rolled out from item" + e.currentTarget.focusedItem);
}

function itemClickHandler(e:Event):void {
trace("you clicked on item" + e.currentTarget.focusedItem);
}

Replace the code within the functions that are defined above to add the functionality that you desire.

Note: Don't forget to remove the value of url attributes in the assets file (images.xml, menu.xml) to have the click function working.

Comments

  • Page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • >
  • loading comments...

nsenga

Posted 11 months ago

i have a problem, my player didn’t started automaticaly

FlashXML Support

Hi,
Please send us the link to your website and we will check where the problem is.

Mike Mezzacappa

Posted one year ago

i am receiving this error when i click on an item in the carousel

TypeError: Error #1009: Cannot access a property or method of a null object reference. at classes::Carousel/navigateToLink()
I dont want the component to open and external link

FlashXML Support

Hi,
Please send us the link to your website and we will check where the problem is.

os

Posted one year ago

Hi, I have a quick question about Banner Rotator FX.
I want left/right arrow keys to control the images. When you hit the right arrow key, the next image comes up, for example. Is there any way to make it in Actionscript 2?

Thank you!

os

FlashXML Support

Hi,
No sorry.

john

Posted one year ago

HI again,

I’m working on the text-menu component and it works fine with the method mentioned in the Q&A
about using events , but is there a way that i can determine which item i clicked so that i can
have a specific action for different items?

ex: when i clicked the “Home” button, i want to dispatch event A, when i clicked the “product” button, i want to dispatch event B…etc

FlashXML Support

e.currentTarget.focusedItem is the value of the button. for example if e.currentTarget.focusedItem is equal to 0, you have press the first button, and so on.

Chris

Posted one year ago

Regarding the Accordion component, if I want to trigger an event from clicking on one item, how would I target that? Below targets the entire component.

MainMenu.addEventListener(“itemRollOver”, itemRollOverHandler);

function itemRollOverHandler(e:Event):void {
trace(“you rolled over item” + e.currentTarget.focusedItem);
}

This doesn’t work:

MainMenu0.addEventListener(“itemRollOver”, itemRollOverHandler);

function itemRollOverHandler(e:Event):void {
trace(“you rolled over item” + e.currentTarget.focusedItem);
}

  • loading comments...
  • Page:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • >

Do you have a question?

you will get an answer in 24 hours, tops.

(required) Only alphanumeric characters allowed
(required) (will not be published)
Please type a message! Your message is too long! Either try to keep within 1500 characters, or contact our support team via email at support [at] flashxml.net.
(will not be published)
You mistyped the two words!
Can't read? Change the image
Format your comments using Textile: *bold*, _italic_, "link text":address, @code@
Connect to us on Facebook Follow us on Twitter Subscribe to our RSS feed
Copyright © FlashXML.net 2009 - 2014