You must be logged in to post Login Register
Search 

can I call a function from an xml menu item used with my main flash movie

User Post

1:51 am
October 11, 2010


redsetter

New Member

posts 1

1

Hi all

I have purchased a menu (AS3 + XML)…very nice, and I have simpleviewer v 2 …also very nice – However – I have absolutely no idea how to get the xml menu buttons to call on the function that loads the relevant  simpleviewer gallery…not very nice

I have spent the weekend going through lots of menus with XML + AS3 but they all seem to fall short of explaining how you get the final xml buttons to interact with any actionscript within your flash movie. This makes me think I am missing something very obvious and if so a polite nudge in the right direction would do just fine. In the mean time this is what I have been doing,

The thought pattern I have at the moment is that I can call a function (that is written on the first frame on the main flash movie) from a button in the xml file. Is this true and if so how?

I have been trying to search for terms such as 'call function from xml' etc but have not found any relevant links

Based on the two code blocks below I tried this within the xml but no luck

That might also explain how blocked I am in my understanding of this. Please, I would greatly appreciate any help in this matter. 

The function/s I want to call from the flash movie is this

function loadGallery1(e:Event){
    loadGallery(“gallery_1.xml”);
}

function loadGallery2(e:Event){
    loadGallery(“gallery_2.xml”);
}

//and the original flash buttons  code

mcButton1.addEventListener(MouseEvent.CLICK,loadGallery1);
mcButton2.addEventListener(MouseEvent.CLICK,loadGallery2);

the xml content block looks like this (taken from the help documents)

The menu_content block looks like this:













The first level in is the main level.
An item can have the following attributes:

text – (String), the label of the buton
action – (String) the action of the button if it doesn’t open a submenu, can be “gotoAndPlay” this works with the frame
or label attributes, “gotoAndStop” this also works with the frame or label attributes or “link” this works with the url and
target attributes.
frame – (Number) a frame from the timeline
label – (String), a frame label in the time line
url – (String), a url
target – (String) the target of the url

I have all the relevant as files for the menu if I need to code them, just really need to know what I should be looking for. As it is a purchased download i am not exactly sure if there is any restrictions on sharing code but it is fairly useless within flash if I cannot get it to work in the first place!

many thanks in advance

Topic RSS 
Search