Hi, can you help me and convert that AS2 code to AS3: http://www.flashframer.com/how-to-create-a-dynamic-xml-navigation-menu/ For you that is 5 minutes, and I’ll can see differents.
Thanks
Hi, can you help me and convert that AS2 code to AS3: http://www.flashframer.com/how-to-create-a-dynamic-xml-navigation-menu/ For you that is 5 minutes, and I’ll can see differents.
Thanks
Oh cmon man …
Umm… how about you have a go at doing it yourself, ask questions if you get stuck and actually learn from the experience? That way you’ll have a far more useful transfer of knowledge, as if someone else just does the work for you then you’ll only skim the surface of learning.
I mean seriously… if you’re not prepared to put any effort in, why should someone else?
ok my question is ho can I do something like that with addChild()
_root.attachMovie(“button”,“btn”+i,_root.getNextGighestDepth());
“button” is an instance name of my movie clip which I want to use as a button in my menu.
I tried to do something like that:
var button:MovieClip = new MovieClip();
addChild(button).name = “btn”+i;
this.getchildByName(“btn”+i).y = y_position;
but I think that is creating a new MovieClip, and I want to use movieClip from library… with instance name “button”
var b:button = new button();
addChild(b);
b.y = 25;
b.alpha = .7;
thanks it’s warking
I think that now I can finish my menu
hmm one question more. When I have
**function xmlLoaded(event:Event):void{
…
for(var i:int = 0; i<xmlList.length(); i++)
…
**
How can I load variable i in new function?
function btnOver(e:Event):void
{
this.getChildByName(“btn”+i).gotoAndPlay(2);
}
[quote=krystek1987;2353914]hmm one question more. When I have
**function xmlLoaded(event:Event):void{
…
for(var i:int = 0; i<xmlList.length(); i++)
…
**
How can I load variable i in new function?
function btnOver(e:Event):void
{
this.getChildByName(“btn”+i).gotoAndPlay(2);
}[/quote]
ActionScript Code:
[LEFT][COLOR=#000000]function[/COLOR] xmlLoadedCOLOR=#000000:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] len:[COLOR=#0000ff]Number[/COLOR] = xmlList.[COLOR=#0000ff]length[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000ff]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]var[/COLOR] i:[COLOR=#0000ff]int[/COLOR]=[COLOR=#000080]0[/COLOR]; i<len; ++i[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
somebtn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]MOUSE_OVER[/COLOR], btnOver[COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
function btnOverCOLOR=#000000[/COLOR]:[COLOR=#0000ff]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
Something like this?
I’m trying to convert AS2 to AS3 code from link [top of the page] There are everything to understend “my” code
if I do:
e.target.gotoAndPlay(2);
I have error:
ReferenceError: Error #1069: Property gotoAndPlay not found on flash.text.TextField and there is no default value.
at FF_Navigation_Menu_2_fla::MainTimeline/btnOver()
that is my first AS code…
thanks for helping
do mouseChildren = false on your button since your textfields are sending the event atm.
hmm, I find something like currentTarget and I see that it’s working. Is it good :)?
But I’ll read about mouseChildren
yes, if “target” doesn’t work, using “currentTarget” is perfectly acceptable - there is a distinct difference that I have yet to get clear within my head
target is the object that flash has targeted for the event
currentTarget is the object that is being called by the listener when the event occurs.
again You have right Can you check this :)?
ActionScript Code:
[LEFT][COLOR=#000000]**var**[/COLOR] y_pozycja:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]var[/COLOR] nazwy:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]Array[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] linki:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000FF]Array[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] [COLOR=#0000FF]xml[/COLOR]:XML;
[COLOR=#000000]var[/COLOR] xmlList:XMLList;
[COLOR=#000000]var[/COLOR] xmlLoader:URLLoader = [COLOR=#000000]new[/COLOR] URLLoaderCOLOR=#000000[/COLOR];
xmlLoader.[COLOR=#0000FF]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]new[/COLOR] URLRequestCOLOR=#000000[/COLOR][COLOR=#000000])[/COLOR];
xmlLoader.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]COMPLETE[/COLOR], xmlLoaded[COLOR=#000000])[/COLOR];
[COLOR=#000000]function[/COLOR] xmlLoadedCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]xml[/COLOR] = [COLOR=#0000FF]XML[/COLOR]COLOR=#000000[/COLOR];
xmlList = [COLOR=#0000FF]xml[/COLOR].[COLOR=#000080]children[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000FF]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] i:[COLOR=#0000FF]int[/COLOR] = [COLOR=#000080]0[/COLOR]; i<xmlList.[COLOR=#0000FF]length[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]; i++[COLOR=#000000])[/COLOR]
[COLOR=#000000]{[/COLOR]
nazwy.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR]xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].@[COLOR=#0000FF]NAME[/COLOR][COLOR=#000000])[/COLOR];
linki.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR]xmlList[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR].@LINK[COLOR=#000000])[/COLOR];
[COLOR=#000000]**var**[/COLOR] b:[COLOR=#0000FF]button[/COLOR] = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000FF]button[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
addChild[COLOR=#000000]([/COLOR]b[COLOR=#000000])[/COLOR].[COLOR=#0000FF]name[/COLOR] = [COLOR=#FF0000]"btn"[/COLOR]+i;
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]y[/COLOR] = y_pozycja;
y_pozycja += [COLOR=#000080]25[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]blackTxt[/COLOR].[COLOR=#000080]Txt[/COLOR].[COLOR=#0000FF]text[/COLOR] = nazwy[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]whiteTxt[/COLOR].[COLOR=#000080]Txt[/COLOR].[COLOR=#0000FF]text[/COLOR] = nazwy[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]MOUSE_OVER[/COLOR],btnOver[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]MOUSE_OUT[/COLOR],btnOut[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR],clicked[COLOR=#000000])[/COLOR];
[COLOR=#0000FF]this[/COLOR].[COLOR=#000080]getChildByName[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"btn"[/COLOR]+i[COLOR=#000000])[/COLOR].[COLOR=#000080]mouseChildren[/COLOR] = [COLOR=#000000]**false**[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] btnOverCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]e[/COLOR].[COLOR=#0000FF]target[/COLOR].[COLOR=#0000FF]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] btnOutCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]e[/COLOR].[COLOR=#0000FF]target[/COLOR].[COLOR=#0000FF]gotoAndPlay[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] clickedCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
[COLOR=#000000]var[/COLOR] nazwa:[COLOR=#0000FF]String[/COLOR] = [COLOR=#0000FF]e[/COLOR].[COLOR=#0000FF]target[/COLOR].[COLOR=#0000FF]name[/COLOR];
[COLOR=#000000]var[/COLOR] [COLOR=#0000FF]index[/COLOR]:[COLOR=#0000FF]String[/COLOR] = nazwa.[COLOR=#0000FF]substring[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]var[/COLOR] request:URLRequest = [COLOR=#000000]new[/COLOR] URLRequestCOLOR=#000000[/COLOR];
navigateToURLCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
:: Copyright KIRUPA 2024 //--