Hello all,
I’m new to Flash ans AS so please bare with me if this problem seems to trivial.
I have set up a movie with a dynamically generated menu using XML.
My intention is for the menu to slide with easing left off the stage when any of the dynamically generated buttons are pressed. However, when I use the code below the menu is postioned imediately off the stage at run time:
item_mc.main_btn.[COLOR=blue]onPress[/COLOR] = [COLOR=blue]Function/COLOR
xTargetmenu_mc = -300
xmenu_mc = [COLOR=blue]getProperty[/COLOR]([COLOR=blue]_root[/COLOR].menu_mc, [COLOR=blue]_x[/COLOR]);
movemenu_mc = [COLOR=blue]_root[/COLOR].xTargetmenu_mc - xmenu_mc;
[COLOR=blue]setProperty[/COLOR]([COLOR=blue]_root[/COLOR].menu_mc, [COLOR=blue]_x[/COLOR], xmenu_mc + (movemenu_mc/5));
I have tried placing the code in a separate function and calling that function when the button is pressed:
item_mc.main_btn.[COLOR=blue]onPress[/COLOR] = xMove
[COLOR=blue]Function[/COLOR] xMove(){
xTargetmenu_mc = -300
xmenu_mc = [COLOR=blue]getProperty[/COLOR]([COLOR=blue]_root[/COLOR].menu_mc, [COLOR=blue]_x[/COLOR]);
movemenu_mc = [COLOR=blue]_root[/COLOR].xTargetmenu_mc - xmenu_mc;
[COLOR=blue]setProperty[/COLOR]([COLOR=blue]_root[/COLOR].menu_mc, [COLOR=blue]_x[/COLOR], xmenu_mc + (movemenu_mc/5));
}
This has a slightly different effect. The menu starts at the desired starting point on the stage and moves when a button is pressed but it only for one iteration, partially to the left.
I have had this code working fine i.e. left handed slide with easing - when the buttons were placed manually upon the stage and the code was placed in a:
[COLOR=blue]onClipEvent /COLOR for each particular button. As you can tell this was not a very efficeint way of doing things hence my attempts to do it all in code.
If any one could spare the time to help me it would be greatly appreciated.
Thanks
Lowey