RE: [Flashcoders] a function tells to move to a frame and then update content in that frame
Isaac, I wanted to show you, and anyone interested, that your idea of frame label navigation in conjunction with XML is doable. To use this example just start a fresh fla, build out the fla according to the structure laid out under 'Structure:' in the comment below, then copy and paste the code into frame 1 of the actions layer. /* FrameLabelNav.fla Example Author: Keith Reinfeld FlashPlayer 9, AS3 Structure: Main Timeline: Three layers: actions buttons textfields actions layer: five blank keyframes frame 1: Actionscript (no frame label) frame 2: frame label: intro frame 3: frame label: labelone frame 4: frame label: labeltwo frame 5: frame label: labelthree buttons layer: two buttons spanning all five frames SimpleButton: prevBtn SimpleButton: nextBtn textfields layer: frame 1: blank keyframe frames 2 - 5: TextField: content_txt spanning last four frames */ // Timeline code in frame 1: stop(); // The order of the XML elements doesn't matter. // However, each name attribute value must be unique. var contentXML:XML = ; // Init vars var labels:Array = this.currentLabels; var frameIndex:uint = 0; var frameMax:uint = labels.length - 1; var nextLbl:FrameLabel = labels[frameIndex]; // Listeners prevBtn.addEventListener(MouseEvent.CLICK, navPrev); nextBtn.addEventListener(MouseEvent.CLICK, navNext); this.addEventListener(Event.ENTER_FRAME, navTo); function navPrev(event:MouseEvent):void { frameIndex = (frameIndex > 0)? --frameIndex: frameIndex; this.addEventListener(Event.ENTER_FRAME, navTo); } function navNext(event:MouseEvent):void { frameIndex = (frameIndex < frameMax)? ++frameIndex: frameIndex; this.addEventListener(Event.ENTER_FRAME, navTo); } function navTo(event:Event):void{ nextLbl = labels[frameIndex]; this.gotoAndStop(nextLbl.name); if(this.content_txt != null){ this.removeEventListener(Event.ENTER_FRAME, navTo); updateTextField(); } } function updateTextField():void{ this.content_txt.text = contentText(contentXML,"frame","name",nextLbl.name,"text")+" (Frame: "+this.currentFrame+")"; } function contentText(node:XML,element:String,att1:String,val1:String,att2:String):Str ing{ return node.elements(element).(@[att1] == val1)@[att2]; } Questions? HTH Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: accessing a text node inside another node in a XMLList
Ok I´ve realized now something. I had before in the script: tabsContentSlideshow = myXML.slideshow.children(); I´ve replaced with: tabsContentSlideshow = myXML.slideshow; Then if i trace " tabsContentSlideshow.children()[0] " it will show : CONECTE-SE Bem-vindo ao Conecte-se! Aqui você encontra vida! Grupos pequenos, células, que se reúnem semanalmente. Nós oramos e desejamos que você desenvolva bons relacionamentos, um propósito, envolvimento e encontre alegria. Vamos servir ao Senhor juntos! alright. now how can I retrieve the text that´s inside the tag ?? ok i-ve just discovered: trace ("dfdf: " + tabsContentSlideshow.children()[0].item[1]); :D thank you people 2009/8/28 Isaac Alves : > I´ve realized actually that flash recognizes the XMLList as having 9 > children, ignoring the tags > > when I was expecting three children , each one of them with also 3 > children ( the tags ). > > Why? > > 2009/8/28 Isaac Alves : >> Hello list, >> >> I have the following XML ( i get that by tracing >> "tabsContentSlideshow" which is a XMLList. >> I-d like to use something like >> >> tabsContentSlideshow[slide][1] >> >> slide is an integer, so for example, if the slide 2 is showing, this >> statement would return the first node inside the second node >> , that is: >> >> SLIDE 2 >> >> but it doesn´t work like that. >> how could I do it ?? >> >> thanks in advance ! >> >> >> >> CONECTE-SE >> Bem-vindo ao Conecte-se! >> Aqui você encontra vida! Grupos pequenos, >> células, que se reúnem semanalmente. Nós oramos e desejamos que você >> desenvolva bons relacionamentos, um propósito, envolvimento e encontre >> alegria. Vamos servir ao Senhor juntos! >> >> >> SLIDE 2 >> Bem-vindo ao slide 2 >> Aqui você encontra vida! Grupos pequenos, >> células, que se reúnem semanalmente. Nós oramos e desejamos que você >> desenvolva bons relacionamentos, um propósito, envolvimento e encontre >> alegria. Vamos servir ao Senhor juntos! >> >> >> SLIDE 3 >> Bem-vindo ao slide 3 >> Aqui você encontra vida! Grupos pequenos, >> células, que se reúnem semanalmente. Nós oramos e desejamos que você >> desenvolva bons relacionamentos, um propósito, envolvimento e encontre >> alegria. Vamos servir ao Senhor juntos! >> >> > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: accessing a text node inside another node in a XMLList
First off, XML can only have one root node, thus you're probably getting some weird errors. If you enclose all of your xml within , you should be fine. - Taka On Fri, Aug 28, 2009 at 11:53 AM, Isaac Alves wrote: > I´ve realized actually that flash recognizes the XMLList as having 9 > children, ignoring the tags > > when I was expecting three children , each one of them with also 3 > children ( the tags ). > > Why? > > 2009/8/28 Isaac Alves : > > Hello list, > > > > I have the following XML ( i get that by tracing > > "tabsContentSlideshow" which is a XMLList. > > I-d like to use something like > > > > tabsContentSlideshow[slide][1] > > > > slide is an integer, so for example, if the slide 2 is showing, this > > statement would return the first node inside the second node > > , that is: > > > > SLIDE 2 > > > > but it doesn´t work like that. > > how could I do it ?? > > > > thanks in advance ! > > > > > > > > CONECTE-SE > > Bem-vindo ao Conecte-se! > > Aqui você encontra vida! Grupos pequenos, > > células, que se reúnem semanalmente. Nós oramos e desejamos que você > > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > > alegria. Vamos servir ao Senhor juntos! > > > > > > SLIDE 2 > > Bem-vindo ao slide 2 > > Aqui você encontra vida! Grupos pequenos, > > células, que se reúnem semanalmente. Nós oramos e desejamos que você > > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > > alegria. Vamos servir ao Senhor juntos! > > > > > > SLIDE 3 > > Bem-vindo ao slide 3 > > Aqui você encontra vida! Grupos pequenos, > > células, que se reúnem semanalmente. Nós oramos e desejamos que você > > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > > alegria. Vamos servir ao Senhor juntos! > > > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] accessing a text node inside another node in a XMLList
tabsContentSlideshow.children()[slide].children()[1] 2009/8/28 Isaac Alves > Hello list, > > I have the following XML ( i get that by tracing > "tabsContentSlideshow" which is a XMLList. > I-d like to use something like > > tabsContentSlideshow[slide][1] > > slide is an integer, so for example, if the slide 2 is showing, this > statement would return the first node inside the second node > , that is: > > SLIDE 2 > > but it doesn´t work like that. > how could I do it ?? > > thanks in advance ! > > > > CONECTE-SE > Bem-vindo ao Conecte-se! > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > > SLIDE 2 > Bem-vindo ao slide 2 > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > > SLIDE 3 > Bem-vindo ao slide 3 > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] accessing a text node inside another node in a XMLList
Hello list, I have the following XML ( i get that by tracing "tabsContentSlideshow" which is a XMLList. I-d like to use something like tabsContentSlideshow[slide][1] slide is an integer, so for example, if the slide 2 is showing, this statement would return the first node inside the second node , that is: SLIDE 2 but it doesn´t work like that. how could I do it ?? thanks in advance ! CONECTE-SE Bem-vindo ao Conecte-se! Aqui você encontra vida! Grupos pequenos, células, que se reúnem semanalmente. Nós oramos e desejamos que você desenvolva bons relacionamentos, um propósito, envolvimento e encontre alegria. Vamos servir ao Senhor juntos! SLIDE 2 Bem-vindo ao slide 2 Aqui você encontra vida! Grupos pequenos, células, que se reúnem semanalmente. Nós oramos e desejamos que você desenvolva bons relacionamentos, um propósito, envolvimento e encontre alegria. Vamos servir ao Senhor juntos! SLIDE 3 Bem-vindo ao slide 3 Aqui você encontra vida! Grupos pequenos, células, que se reúnem semanalmente. Nós oramos e desejamos que você desenvolva bons relacionamentos, um propósito, envolvimento e encontre alegria. Vamos servir ao Senhor juntos! ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: accessing a text node inside another node in a XMLList
I´ve realized actually that flash recognizes the XMLList as having 9 children, ignoring the tags when I was expecting three children , each one of them with also 3 children ( the tags ). Why? 2009/8/28 Isaac Alves : > Hello list, > > I have the following XML ( i get that by tracing > "tabsContentSlideshow" which is a XMLList. > I-d like to use something like > > tabsContentSlideshow[slide][1] > > slide is an integer, so for example, if the slide 2 is showing, this > statement would return the first node inside the second node > , that is: > > SLIDE 2 > > but it doesn´t work like that. > how could I do it ?? > > thanks in advance ! > > > > CONECTE-SE > Bem-vindo ao Conecte-se! > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > > SLIDE 2 > Bem-vindo ao slide 2 > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > > SLIDE 3 > Bem-vindo ao slide 3 > Aqui você encontra vida! Grupos pequenos, > células, que se reúnem semanalmente. Nós oramos e desejamos que você > desenvolva bons relacionamentos, um propósito, envolvimento e encontre > alegria. Vamos servir ao Senhor juntos! > > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] help with frame navigation and xml
But what's weird is it did show up for me on the list - just not you two Jason Merrill Bank of America Global Learning Learning & Performance Soluions Monthly meetings on making the most of the Adobe Flash Platform - presented by bank associates, Adobe engineers, and outside experts in the borader multimedia community - join the Bank of America Flash Platform Community (note: this is for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
FW: [Flashcoders] help with frame navigation and xml
>> Howdy Jason, >>Didn't see a reply from you come through. Just you query (tit)... ;), then >>the email that said you answered it before. Nothing in between them. That happens to me on this list sometimes, but only this list. Seems this list only accepts pure text formatted e-mails and if you forget that and send in another format, it rejects your messages silently. Sorry about that. Isaac, here was my reply to your question yesterday from the thread, "help with frame navigation and xml": You don't need any code inside the clip, I think you're approaching this the wrong way around. Why have the XML node based on the frame's label? You already know it's going to "intro" since you have to tell the MovieClip to go there. Do something like this instead: var destination:String = "intro"; myClip.gotoAndPlay(destination); myClip.myTextField.text = myXML.myNode.(@destination); Or could be this if your text is in the text node: var destination:String = "intro"; myClip.gotoAndPlay(destination); myClip.myTextField.text = myXML.myNode.(@destination).text(); Hope that helps, Jason Merrill Bank of America Global Learning Learning & Performance Soluions Monthly meetings on making the most of the Adobe Flash Platform - presented by bank associates, Adobe engineers, and outside experts in the borader multimedia community - join the Bank of America Flash Platform Community (note: this is for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Re: a function tells to move to a frame and then update content in that frame
Howdy Jason, Didn't see a reply from you come through. Just you query (tit)... ;), then the email that said you answered it before. Nothing in between them. Just a FYI. Later, John on 8/28/09 12:18 PM, Merrill, Jason at jason.merr...@bankofamerica.com wrote: > I answered you yesterday, did you not see my post? John R. Sweeney Jr. Interactive Multimedia Developer OnDemand Interactive Inc 945 Washington Blvd. Hoffman Estates, IL 60169 Office/Fax: 847.310.5959 Cellular: 847.651.4469 www.ondemandinteractive.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Re: a function tells to move to a frame and then update content in that frame
I answered you yesterday, did you not see my post? Jason Merrill Bank of America Global Learning Learning & Performance Soluions Monthly meetings on making the most of the Adobe Flash Platform - presented by bank associates, Adobe engineers, and outside experts in the borader multimedia community - join the Bank of America Flash Platform Community (note: this is for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: a function tells to move to a frame and then update content in that frame
HEy Jason, don't worry, that's not a porno web site. "tit" is for "title" ..:D if that's not the answer you were expecting, it is not a website, it is a "powerpoint-like-presentation" to be run off-line, with a whole bunch of an endless content (that is, a terrible nightmare), that i have to pick from .doc files. so everything is in an xml file, and this function puts the content of a specific element in the content.xml file and organizes it all on the display list. that was the only way i found to do this kind of job, otherwise (if i put content directly into the .fla file) the flash application gets extremelly lagged and thus impossible to work, which was making me completely insane . so... that's i'mtrying to build this function that tells a certain moviecli'p to go to a specific frame and then update content in that frame, like searching text in an xml file and putting in the textfield on that frame. i'll have to do that because this updateContent function won't fit in some specific frames of the presentation thanks! 2009/8/28 Isaac Alves : > oops the code down there should be: > > function updateContent(e:Event):void { > > container.gotoAndStop(2); > > link = String(e.target.frameLink); > counter = 0; > > if (content[link].tit != undefined) > { > container._tit.text = content[link].tit; > counter ++; > } > else > { > container._tit.text = ""; > } > etc... > > 2009/8/28 Isaac Alves : >> Hello! >> >> In the following code, i tell the Flash runtime to go to frame2 and >> update the content of this frame. >> >> The problem is that, the first time this function runs it throws the error: >> >> TypeError: Error #1009: >> >> I believe that happens because it tries to update "container._tit" >> before render the screen, so it will be still in frame 1. It goes to >> frame 2 but doesn't update the _tit textfield. >> >> I've tried to solve it this way: instead of using gotoAndStop(2) i've >> called another functiion with that statement and updateAfterEvent(); >> >> but it seems that it is not a method of the Event class. >> >> Any solution ?? >> thanks in advance!! >> >> >> >> function updateContent(e:Event):void { >> >> gotoAndStop(2); >> >> link = String(e.target.frameLink); >> counter = 0; >> >> if (content[link].tit != undefined) >> { >> container._tit.text = content[link].tit; >> counter ++; >> } >> else >> { >> container._tit.text = ""; >> } >> etc... >> > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] :::Html Text & inline Image SOLVED
from my wise colleague Ben Fhala, basically this is the only way: we need to find the last char of the sentence, in this case a "period" and attach an image. var mcQuote = new lmcQuote(); isWhite = false; //hack var box:Object = txt.getCharBoundaries(txt.text.lastIndexOf(".")+2); mcQuote.buttonMode=false; mcQuote.mouseChildren=false; mcQuote.x = txt.x + box.x + box.width/2+ 4; mcQuote.y = txt.y + box.y + box.height/2 -1; / /thanks BEN! * * artur wrote: i need to add an graphical end qoute to a line of text. but the image keeps breaking over into a new line. is there a clever workaround? i have a nasty deadline! thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] a function tells to move to a frame and then updatecontent in that frame
>> but doesn't update the _tit textfield. Wait, hold the phone, what kind of site are you building? Jason Merrill Bank of America Global Learning Learning & Performance Soluions Monthly meetings on making the most of the Adobe Flash Platform - presented by bank associates, Adobe engineers, and outside experts in the borader multimedia community - join the Bank of America Flash Platform Community (note: this is for Bank of America employees only) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] ::::Html Text & inline Image Problem
i need to add an graphical end qoute to a line of text. but the image keeps breaking over into a new line. is there a clever workaround? i have a nasty deadline! thanks -- *artur :.* - *www.artur.com* - *ar...@artur.com* - *ph:646.797.3320* ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] add string to a function
this is possibly a very basic problem, I'm still building my dynamic global sub nav, slooowly. what I want to know if can I add a string to a function, I have my initial first level navigation, I click a button and then if the button has children in that section it says true and then brings up the corresponding children to populate that subnav, I was going to have 3 separate functions for the subnavs what I'm unsure about is the line: 'createSubNav "+page"(); ///I wanted to then have the following functions createSubNavHis createSubNavHerscreateSubNavTheirs //is this possible? //here is my code on the first level buttons/// function mouseClickHandler(e:Event):void { //var siteNav:XML = IXml(assets.siteNav).xml; var page:String=e.target.label.text; trace(page); targetPage=e.target.linkTo; //targetPage = e.target.linkTo; if (e.target.kiddies.children().length()>0) { hasChildren=true; TweenMax.to(nav1, 0.25, {x:-200, ease:Bounce.easeInOut}); trace(e.target.kiddies.children()); createSubNav "+ page"() ; trace(hasChildren); } else { hasChildren=false; trace(hasChildren); Gaia.api.goto("" + [targetPage] + ""); } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] a function tells to move to a frame and then update content in that frame
Hello! In the following code, i tell the Flash runtime to go to frame2 and update the content of this frame. The problem is that, the first time this function runs it throws the error: TypeError: Error #1009: I believe that happens because it tries to update "container._tit" before render the screen, so it will be still in frame 1. It goes to frame 2 but doesn't update the _tit textfield. I've tried to solve it this way: instead of using gotoAndStop(2) i've called another functiion with that statement and updateAfterEvent(); but it seems that it is not a method of the Event class. Any solution ?? thanks in advance!! function updateContent(e:Event):void { gotoAndStop(2); link = String(e.target.frameLink); counter = 0; if (content[link].tit != undefined) { container._tit.text = content[link].tit; counter ++; } else { container._tit.text = ""; } etc... ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Re: a function tells to move to a frame and then update content in that frame
oops the code down there should be: function updateContent(e:Event):void { container.gotoAndStop(2); link = String(e.target.frameLink); counter = 0; if (content[link].tit != undefined) { container._tit.text = content[link].tit; counter ++; } else { container._tit.text = ""; } etc... 2009/8/28 Isaac Alves : > Hello! > > In the following code, i tell the Flash runtime to go to frame2 and > update the content of this frame. > > The problem is that, the first time this function runs it throws the error: > > TypeError: Error #1009: > > I believe that happens because it tries to update "container._tit" > before render the screen, so it will be still in frame 1. It goes to > frame 2 but doesn't update the _tit textfield. > > I've tried to solve it this way: instead of using gotoAndStop(2) i've > called another functiion with that statement and updateAfterEvent(); > > but it seems that it is not a method of the Event class. > > Any solution ?? > thanks in advance!! > > > > function updateContent(e:Event):void { > > gotoAndStop(2); > > link = String(e.target.frameLink); > counter = 0; > > if (content[link].tit != undefined) > { > container._tit.text = content[link].tit; > counter ++; > } > else > { > container._tit.text = ""; > } > etc... > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] just target children of particular node
sorry worked it out - was easy and obvious - doh! for each (var section:XML in siteNav.section[3].subsection) { -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of thomas horner Sent: 28 August 2009 12:06 To: Flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] just target children of particular node ok in the following xml how would i create a loop just from the children of "his" for each (var section:XML in siteNav.section.subsection) { ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] just target children of particular node
ok in the following xml how would i create a loop just from the children of "his" for each (var section:XML in siteNav.section.subsection) { ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] add string to a function
ok my menu goes on almost there now... i have now launched the a function from my inital menu level to create the sub nav for that page as per earlier help; im basically using the same code for creating my inital menu, but i want to only create buttons for the children of the button i've just clicked on, i suppose i need the function 'createSubNavtheirs' to reference the 'mouseClickHandler' and only create menu items from the child node of the button that has been clicked. //here is one of the functions for a subbutton/// function createSubNavtheirs():void { siteNav=IXml(assets.siteNav).xml; /*var xmlLabels:xmllist=sitenav.secti...@name; var labelsArray:Array /* of String */ /* = new Array(xmlLabels.length);*/ var runningX:Number=0; for each (var section:XML in siteNav.section.subsection) { var navbut:navItem = new navItem( ); navbut.label.text=secti...@name; navbut.label.autoSize=TextFieldAutoSize.LEFT; navbut.hit.width=navbut.label.width; navbut.hit.height=30; navbut.hit.alpha=0; navbut.kiddies=section; navbut.linkto=secti...@src; //read instructions fomr nav xml navbut.keepopen=sitenav.secti...@keep; navbut.isclicked=sitenav.secti...@highlight; //trace(section); navbut.x=runningX; runningX+=navbut.width+10; trace(runningX); navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=sitenav.secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); //navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler2); //navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); //navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); nav2.addChild(navbut); } } //here is the code on my initial subbutton// function mouseClickHandler(e:Event):void { //var siteNav:XML = IXml(assets.siteNav).xml; var page:String=e.target.label.text; trace(page); targetPage=e.target.linkTo; //targetPage = e.target.linkTo; if (e.target.kiddies.children().length()>0) { hasChildren=true; TweenMax.to(nav1, 0.25, {x:-200, ease:Bounce.easeInOut}); trace(e.target.kiddies.children()); this["createSubNav"+page](); //trace(page); trace(targetPage); trace(hasChildren); } else { hasChildren=false; trace(hasChildren); Gaia.api.goto("" + [targetPage] + ""); } } ///and here is my xml/// -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of thomas horner Sent: 28 August 2009 10:49 To: 'Flash Coders List' Subject: RE: [Flashcoders] add string to a function thanks for the first answer, works a treat, i'm not really sure what other stuff is though! thanks, -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: 28 August 2009 10:35 To: Flash Coders List Subject: Re: [Flashcoders] add string to a function ps a better option might be a parameter and a switchstatement On Fri, Aug 28, 2009 at 11:20 AM, thomas horner wrote: > this is possibly a very basic problem, I'm still building my dynamic > global sub nav, slooowly. > > > > what I want to know if can I add a string to a function, > > > > I have my initial first level navigation, I click a button and then if the > button has children in that section it says true and
RE: [Flashcoders] add string to a function
thanks for the first answer, works a treat, i'm not really sure what other stuff is though! thanks, -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Hans Wichman Sent: 28 August 2009 10:35 To: Flash Coders List Subject: Re: [Flashcoders] add string to a function ps a better option might be a parameter and a switchstatement On Fri, Aug 28, 2009 at 11:20 AM, thomas horner wrote: > this is possibly a very basic problem, I'm still building my dynamic > global sub nav, slooowly. > > > > what I want to know if can I add a string to a function, > > > > I have my initial first level navigation, I click a button and then if the > button has children in that section it says true and then brings up the > corresponding children to populate that subnav, > > > > I was going to have 3 separate functions for the subnavs > > > > > > > > what I'm unsure about is the line: 'createSubNav "+page"(); > > > > ///I wanted to then have the following functions createSubNavHis > createSubNavHerscreateSubNavTheirs > > > > //is this possible? > > > > //here is my code on the first level buttons/// > > > > > > function mouseClickHandler(e:Event):void { > > > >//var siteNav:XML = > IXml(assets.siteNav).xml; > >var > page:String=e.target.label.text; > >trace(page); > >targetPage=e.target.linkTo; > > > >//targetPage = > e.target.linkTo; > > > > > > > > > >if > (e.target.kiddies.children().length()>0) { > > > hasChildren=true; > > > TweenMax.to(nav1, 0.25, {x:-200, ease:Bounce.easeInOut}); > > > trace(e.target.kiddies.children()); > > createSubNav > "+ page"() ; > > > > > > > > > trace(hasChildren); > >} else { > > > hasChildren=false; > > > trace(hasChildren); > > > Gaia.api.goto("" + [targetPage] + ""); > > > >} > >} > > > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] add string to a function
ps a better option might be a parameter and a switchstatement On Fri, Aug 28, 2009 at 11:20 AM, thomas horner wrote: > this is possibly a very basic problem, I'm still building my dynamic > global sub nav, slooowly. > > > > what I want to know if can I add a string to a function, > > > > I have my initial first level navigation, I click a button and then if the > button has children in that section it says true and then brings up the > corresponding children to populate that subnav, > > > > I was going to have 3 separate functions for the subnavs > > > > > > > > what I'm unsure about is the line: 'createSubNav "+page"(); > > > > ///I wanted to then have the following functions createSubNavHis > createSubNavHerscreateSubNavTheirs > > > > //is this possible? > > > > //here is my code on the first level buttons/// > > > > > > function mouseClickHandler(e:Event):void { > > > >//var siteNav:XML = > IXml(assets.siteNav).xml; > >var > page:String=e.target.label.text; > >trace(page); > >targetPage=e.target.linkTo; > > > >//targetPage = > e.target.linkTo; > > > > > > > > > >if > (e.target.kiddies.children().length()>0) { > > > hasChildren=true; > > > TweenMax.to(nav1, 0.25, {x:-200, ease:Bounce.easeInOut}); > > > trace(e.target.kiddies.children()); > >createSubNav > "+ page"() ; > > > > > > > > > trace(hasChildren); > >} else { > > > hasChildren=false; > > > trace(hasChildren); > > > Gaia.api.goto("" + [targetPage] + ""); > > > >} > >} > > > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] add string to a function
Hi, you are looking for: this["createSubNav"+page](); HTH JC On Fri, Aug 28, 2009 at 11:20 AM, thomas horner wrote: > this is possibly a very basic problem, I'm still building my dynamic > global sub nav, slooowly. > > > > what I want to know if can I add a string to a function, > > > > I have my initial first level navigation, I click a button and then if the > button has children in that section it says true and then brings up the > corresponding children to populate that subnav, > > > > I was going to have 3 separate functions for the subnavs > > > > > > > > what I'm unsure about is the line: 'createSubNav "+page"(); > > > > ///I wanted to then have the following functions createSubNavHis > createSubNavHerscreateSubNavTheirs > > > > //is this possible? > > > > //here is my code on the first level buttons/// > > > > > > function mouseClickHandler(e:Event):void { > > > >//var siteNav:XML = > IXml(assets.siteNav).xml; > >var > page:String=e.target.label.text; > >trace(page); > >targetPage=e.target.linkTo; > > > >//targetPage = > e.target.linkTo; > > > > > > > > > >if > (e.target.kiddies.children().length()>0) { > > > hasChildren=true; > > > TweenMax.to(nav1, 0.25, {x:-200, ease:Bounce.easeInOut}); > > > trace(e.target.kiddies.children()); > >createSubNav > "+ page"() ; > > > > > > > > > trace(hasChildren); > >} else { > > > hasChildren=false; > > > trace(hasChildren); > > > Gaia.api.goto("" + [targetPage] + ""); > > > >} > >} > > > > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders