[Flashcoders] floating wordpress blog within a swf?
Is it possible to have a wordpress blog floating within a swf? or something as to that effect, it would be nice to keep the viewer at the site rather then redirecting them to a new window, is this possible? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] FW: incorperating automatic thumbnail generator php script for my flash cms
A little while ago flep studio released a free cms and xml generator for as3; http://www.flepstudio.org/forum/flepstudio-utilities/4739-flash-xml-editor.h tml to build a gallery from the xml file it outputs is fairly simple but i would like it to create thumbnails on the fly, when the client uploads the large images a set of thumbnails is automatically create and place in a thumbs folder in the category folder that the cms creates, it would also be good to update the xml too, i've done a little research and there are some php scripts such as; http://www.anyexample.com/programming/php/php_multiple_photo_thumbnail_gener ator.xml that seem to do what im after, i suppose i need to incorperate that into the upload.php file in the cms? ?php //path to storage $storage = $_REQUEST[folder]; //path name of file for storage $uploadfile = $storage/ . basename( $_FILES['Filedata']['name'] ); //if the file is moved successfully if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) { $answer=ok; echo answer=.$answer; //file failed to move }else{ $answer=no; echo answer=.$answer; } ? many help much appreciated, ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] incorperating automatic thumbnail generator php script for my flash cms
A little while ago flep studio released a free cms and xml generator for as3; http://www.flepstudio.org/forum/flepstudio-utilities/4739-flash-xml-editor.h tml to build a gallery from the xml file it outputs is fairly simple but i would like it to create thumbnails on the fly, when the client uploads the large images a set of thumbnails is automatically create and place in a thumbs folder in the category folder that the cms creates, it would also be good to update the xml too, i've done a little research and there are some php scripts such as; http://www.anyexample.com/programming/php/php_multiple_photo_thumbnail_gener ator.xml that seem to do what im after, i suppose i need to incorperate that into the upload.php file in the cms? ?php //path to storage $storage = $_REQUEST[folder]; //path name of file for storage $uploadfile = $storage/ . basename( $_FILES['Filedata']['name'] ); //if the file is moved successfully if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) { $answer=ok; echo answer=.$answer; //file failed to move }else{ $answer=no; echo answer=.$answer; } ? many help much appreciated, ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] how do i say string + anything?
i've built a global nav but now when it comes to detecting the current page and updating the subnav accordingly i've got a little stuck, i think im nearly there, what i need to know if how to say is ; if(event.validBranch == index/nav/his + anything else that might follow){ basically how do i say index/nav/his + anything){ function onAfterGoto(event:GaiaEvent):void { trace(current branch = + event.validBranch); if(event.validBranch == index/nav/his++){ createSubNavhis(); TweenMax.to(menuBar, 0.25, {x:-270, ease:Bounce.easeInOut}); createBackButton() } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] how do i say string + anything?
i ended up using a slice, bit messy but worked. function onAfterGoto(event:GaiaEvent):void { var subString:String; subString=event.validBranch; trace(subslice = + subString.slice( 13 ) ); trace(current branch = + event.validBranch); if ((nav2.numChildren 0) (event.validBranch == (index/nav/his+ subString.slice(13 { createSubNavhis(); TweenMax.to(menuBar, 0.25, {x:-270, ease:Bounce.easeInOut}); createBackButton(); } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth Kawamoto Sent: 23 September 2009 13:57 To: Flash Coders List Subject: Re: [Flashcoders] how do i say string + anything? Or you could just use indexOf(). Kenneth Kawamoto http://www.materiaprima.co.uk/ strk wrote: On Wed, Sep 23, 2009 at 12:40:55PM +0100, thomas horner wrote: what i need to know if how to say is ; if(event.validBranch == index/nav/his + anything else that might follow){ Compare a substring of event.validBranch, from start to length of index/nav/his. --strk; Free GIS Flash consultant/developer () ASCII Ribbon Campaign http://foo.keybit.net/~strk/services.html /\ Keep it simple! ___ 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] trouble with adding/removing multiple preloaders on thumbs
Hi many thanks, will check this out in a sec, just having a full english breakfast, yes managed to do the product zoomer with a lot of help from 'Cor' on here. it works really well, and i've made it kind of dynmaic so you can select different angles to zoom, you are quite welcome to the fla is you want, thanks, Thomas -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Keith Reinfeld Sent: 19 September 2009 07:52 To: 'Flash Coders List' Subject: RE: [Flashcoders] trouble with adding/removing multiple preloaders on thumbs Thomas, I think the example code below addresses your primary concerns. The biggest changes involve using a loaderArray to prevent overwriting previous Loader() assignments, and also using getChildByName() to grab the relevant preloader instance for removal. See inline comments. Let me know if you have any questions. So, did you work out your image panning interaction? Code: import gs.TweenLite; var myXML:XML = pics IMAGE SMALL=images/pic1.jpg/ IMAGE SMALL=images/pic2.jpg/ IMAGE SMALL=images/pic3.jpg/ IMAGE SMALL=images/pic4.jpg/ IMAGE SMALL=images/pic5.jpg/ /pics; var container1:MovieClip = new MovieClip(); var loaderArray:Array = []; addChild(container1); var my_images:XMLList = myXML.IMAGE; var my_total:Number = my_images.length(); callThumbs(); function callThumbs():void { for (var s:Number = 0; s my_total; s++) { var thumb_url:String = my_images[...@small; // Store each Loader separately as an array element // so it won't be overwritten by the next. - KR loaderArray[s] = new Loader(); loaderArray[s].load(new URLRequest(thumb_url)); loaderArray[s].contentLoaderInfo.addEventListener(Event.COMPLETE,thumbLoaded ); var preloader:starPreloader = new starPreloader(); // Name the preloader instance after the current url's // filename so we can pick-up on it later. - KR preloader.name = thumb_url.substr(thumb_url.lastIndexOf(/)+1); loaderArray[s].y = 105 * s; // I am not putting the preloader 'in' the thumbnail, // just overlaying it. - KR preloader.y = 105 * s; //add preloader to the container container1.addChild(preloader); container1.buttonMode = true; // The next two lines caused reference errors for me - KR //zoom.small.addChild(container1); //container1.addEventListener(MouseEvent.CLICK, callFull); } } function thumbLoaded(e:Event):void { var my_thumb:Loader=Loader(e.target.loader); // Display the thumbnail image behind the preloader. - KR container1.addChildAt(my_thumb,0); // Here is where we identify the preloader that // corresponds with the current thumbnail image. - KR var currentURL:String = e.currentTarget.url; var preloaderName:String = currentURL.substr(currentURL.lastIndexOf(/)+1); trace(\npreloaderName =,preloaderName); var preloader:starPreloader = container1.getChildByName(preloaderName) as starPreloader; TweenLite.to(preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0, onComplete:thumbFinished, onCompleteParams:[container1, preloader]}); } function thumbFinished(mc:MovieClip, mc2:starPreloader):void { trace(\nthumbFinished() called,mc.name,mc2.name); //Remove the preloader mc.removeChild(mc2); } Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ 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] problem removing multiple instances of preloader
i have set up a thumbnail image gallery that drags images from an external xml file, however now i have come the point of adding a preloader, i want to add a preloader to each of the thumbnails, however it only seems to work for one thumbnail or image, if i just target [0] it works fine, but when i add the preloader to all my image containers and then try to remove them all it trips up, many thanks in advance, any help greatly appreciated. my code is below; my_images=myXML.IMAGE; my_total=my_images.length(); function callThumbs():void { for (var s:Number = 0; s my_total; s++) { var thumb_url=my_images[...@small; var thumb_loader = new Loader(); thumb_loader.load(new URLRequest(thumb_url)); thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded); //add preloader to the container var preloader:starPreloader = new starPreloader(); container1.addChild(preloader); container1.preloader=preloader; thumb_loader.name=s; container1.buttonMode=true; thumb_loader.y = (100+5)*s; zoom.small.addChild(container1); container1.addEventListener(MouseEvent.CLICK, callFull); loadedImages ++; } } function thumbLoaded(e:Event):void { var my_thumb:Loader=Loader(e.target.loader); var holder:MovieClip=container1[loadedImages]; TweenLite.to(container1.preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0, onComplete:thumbFinished, onCompleteParams:[container1.preloader, holder]}); container1.addChild(my_thumb); } function thumbFinished(preloader:MovieClip, container1:MovieClip):void { container1.removeChild(preloader); //Remove the preloader } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] trouble with adding/removing multiple preloaders on thumbs
i have set up a thumbnail image gallery that drags images from an external xml file, however now i have come the point of adding a preloader, i want to add a preloader to each of the thumbnails, however it only seems to work for one thumbnail or image, if i just target [0] it works fine, but when i add the preloader to all my image containers and then try to remove them all it trips up, TypeError: Error #1009: Cannot access a property or method of a null object reference. at MethodInfo-448() at Function/http://adobe.com/AS3/2006/builtin::apply() at gs::TweenLite/complete() at gs::TweenLite/render() at gs::TweenLite$/updateAll() my code is below; my_images=myXML.IMAGE; my_total=my_images.length(); function callThumbs():void { for (var s:Number = 0; s my_total; s++) { var thumb_url=my_images[...@small; var thumb_loader = new Loader(); thumb_loader.load(new URLRequest(thumb_url)); thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded); //add preloader to the container var preloader:starPreloader = new starPreloader(); container1.addChild(preloader); container1.preloader=preloader; thumb_loader.name=s; container1.buttonMode=true; thumb_loader.y = (100+5)*s; zoom.small.addChild(container1); container1.addEventListener(MouseEvent.CLICK, callFull); loadedImages ++; } } function thumbLoaded(e:Event):void { var my_thumb:Loader=Loader(e.target.loader); var holder:MovieClip=container1[loadedImages]; TweenLite.to(container1.preloader, 1, {scaleX: 0, scaleY: 0, alpha: 0, onComplete:thumbFinished, onCompleteParams:[container1.preloader, holder]}); container1.addChild(my_thumb); } function thumbFinished(preloader:MovieClip, container1:MovieClip):void { container1.removeChild(preloader); //Remove the preloader } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] (no subject)
ok, i'm trying to build a java style zoom view, where you have a small image of a product you mouseover it and this then navigates you round an enlarged view to the right of it, i've done a very quick mock up zipped here, but am useless at math and need to know how to go abouts working out the way to equate the corresponding .x and .y for the large image. many thanks, T. code import gs.*; var masker:MovieClip; var small:MovieClip; var big:MovieClip; big.mask = masker; var b = small.getBounds(this); trace(b); small.addEventListener(MouseEvent.MOUSE_MOVE, smallHover); function smallHover (Event:MouseEvent):void{ //trace(mouseX+ mouseX); //trace(big.x + bigX); TweenMax.to(big, 1, {x:mouseX}); big.y = mouseY } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] javascript style magic zoom in as3
can anyone point me in the direction of a tutorial for how to build a javascript style product zoomer like magic zoom one featureed in this link; http://www.magictoolbox.com/magiczoom/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] product sector zoomer
need to create a product zoomer like the javascript zoomer, but in as3, could this by done by bitmap data and scaling up or by masking of the larger image and panning to the relevant co-ordinates. if any one knows of any literature or tutorials ? http://www.magictoolbox.com/magiczoom/ thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] problem with dictonary on dynamic buttons
thanks i figured this out in the end my self. you dont happen to know anything about building a java style zoom viewer in as3; http://www.magictoolbox.com/magiczoom/ i assume you need to use bitmapdata -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of jonathan howe Sent: 04 September 2009 14:34 To: Flash Coders List Subject: Re: [Flashcoders] problem with dictonary on dynamic buttons Your dictionary is built off of that goto attribute but then you're passing in an instance of the object into the dictionary array. You have not assigned a name property to your assets. So when defining them you might also set the .name property to the @goto attribute. e.target as String will return undefined if you don't manually assign a name string. (A Sprite does not know the name of the instance variable that was used to store it). Haven't read all of your code but you might also consider trace(dict[e.target.no...@goto]); but you'll probably have to do some casting. -jonathan On Thu, Sep 3, 2009 at 1:19 PM, thomas hornertho...@megawattmedia.co.uk wrote: ok i'm creating a dictionary to store the values contained by some sprites that im using as button but i keep getting term undefined when i click on the item in the output. //create dictionary to store data public var dict:Dictionary = new Dictionary(); for (var Wi:int=0; Wi len; Wi++) { if (assetArray[Wi] is IBitmapSprite) { trace(assetArray[Wi]); var myBitmap=IBitmapSprite(assetArray[Wi]).container; IBitmapSprite(assetArray[Wi]).content.visible=true; //assign data to dictionary item dict[(assetArray[Wi]).no...@goto] myBitmap.visible=true; myBitmap.x=xPos; myBitmap.y=0; xPos=xPos+myBitmap.width+padding; myBitmap.alpha=1; trace(myBitmap.x); trace(myBitmap.width); // new stuff myBitmap.buttonMode=true; myBitmap.addEventListener(MouseEvent.CLICK, bitmapClick); scroller.holder.addChild(myBitmap); } function bitmapClick(e:Event) { trace(dict[e.target]); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe ___ 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] product sector zoomer
well i'm buidling an entire flash site so it would be within that would all be done in as3, i suppose the principal is to have as you say a low res and a corresponding hi res image, that is masked. and the low res would have a mouse over function with a box that is the zoom region, that pans the hi res image. i think this would be simpler and smoother than using bitmap data, thanks, T -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Olivier Besson Sent: 04 September 2009 14:47 To: Flash Coders List Subject: Re: [Flashcoders] product sector zoomer it seems that your example uses 2 different images (low-res and high-res). The high-res would have to be behind a mask. The rest is geometry ... A question raising to mind is: do you want to display the zoom area in front of HTML (oustside the flash movie), as in your example, or should it be in a dedicated area of your flash movie? I suspect it's not possible to display content outside the flash movie in pure actionscript (without javascript). thomas horner a écrit : need to create a product zoomer like the javascript zoomer, but in as3, could this by done by bitmap data and scaling up or by masking of the larger image and panning to the relevant co-ordinates. if any one knows of any literature or tutorials ? http://www.magictoolbox.com/magiczoom/ thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com -- Olivier Besson (gludion) - (33 1) 44 64 78 99 http://www.gludion.com http://blog.gludion.com ___ 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] problem with dictonary on dynamic buttons
ok i'm creating a dictionary to store the values contained by some sprites that im using as button but i keep getting term undefined when i click on the item in the output. //create dictionary to store data public var dict:Dictionary = new Dictionary(); for (var Wi:int=0; Wi len; Wi++) { if (assetArray[Wi] is IBitmapSprite) { trace(assetArray[Wi]); var myBitmap=IBitmapSprite(assetArray[Wi]).container; IBitmapSprite(assetArray[Wi]).content.visible=true; //assign data to dictionary item dict[(assetArray[Wi]).no...@goto] myBitmap.visible=true; myBitmap.x=xPos; myBitmap.y=0; xPos=xPos+myBitmap.width+padding; myBitmap.alpha=1; trace(myBitmap.x); trace(myBitmap.width); // new stuff myBitmap.buttonMode=true; myBitmap.addEventListener(MouseEvent.CLICK, bitmapClick); scroller.holder.addChild(myBitmap); } function bitmapClick(e:Event) { trace(dict[e.target]); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] making a right to left horizontal content scroller
ok this is more of a maths issue, which i'm bloody useless at! i have a horizontal left to right scroller and basically want it to do the opposite and scroll from right to left, i have positioned my content holder at stage.stageWidth and am position my content in the loop by subtracting. but am a bit stuck; public var contentAreaX:int = 0; public var scrollbarX:int=0; public var scrollbarY:int=0; public var xOffset:Number; public var xMin:Number=0; public var xMax:Number=0; public var sp:Number; xMax = stage.stageWidth - scroller.scrollbar.thumb.width; stage.addEventListener(Event.RESIZE, resizeHandler); stage.dispatchEvent(new Event(Event.RESIZE)) scroller.scrollbar.x = scrollbarX; scroller.scrollbar.y = scrollbarY; //what happens when you click the scrollbar thumb function thumbDown(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove); xOffset = mouseX - scroller2.scrollbar.thumb.x; } //what happens when you release the scrollbar thumb function thumbUp(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove); } //what happens when you move the scrollbar thumb function thumbMove(e:MouseEvent):void { scroller2.scrollbar.thumb.x = mouseX - xOffset; xMax = stage.stageWidth - scroller2.scrollbar.thumb.width; if (scroller2.scrollbar.thumb.x = xMin) { scroller2.scrollbar.thumb .x = xMin; } if (scroller2.scrollbar.thumb.x = xMax) { scroller2.scrollbar.thumb.x = xMax; } var sp:Number = scroller2.scrollbar.thumb.x / xMax; TweenMax.to(scroller2.holder, 0.6, { x:(sp * (stage.stageWidth - (scroller2.holder.width + (contentAreaX * 2, ease:Quad.easeOut} ); e.updateAfterEvent(); } //what happens when you click somewhere along the scrollbar track function moveThumb(e:MouseEvent):void { sp = mouseX / xMax; if (mouseX = (scroller2.scrollbar.thumb.x + scroller2.scrollbar.thumb.width) ) { TweenMax.to(scroller2.scrollbar.thumb, 1.0, { x:(mouseX - scroller2.scrollbar.thumb.width), ease:Quad.easeOut } ); sp = (mouseX - scroller2.scrollbar.thumb.width) / xMax; } else { TweenMax.to(scroller2.scrollbar.thumb, 1.0, { x:mouseX, ease:Quad.easeOut } ); sp = mouseX / xMax; } TweenMax.to(scroller2.holder, 1.0, { x:(sp * ((stage.stageWidth) - scroller2.holder.width)), ease:Quad.easeOut } ); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
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 tho...@megawattmedia.co.ukwrote: 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
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/// site section name=about src=index/nav/about keep=false/ section name=hers src=index/nav/hers keep=false subsection name=small src=index/nav/hers/smalltheirs keep=true / subsection name=medium src=index/nav/hers/mediumtheirs keep=true / subsection name=large src=index/nav/hers/largetheirs keep=true / /section section name=his src=index/nav/his keep=false subsection name=small src=index/nav/his/smalltheirs keep=true / subsection name=medium src=index/nav/his/mediumtheirs keep=true / subsection name=large src=index/nav/his/largetheirs keep=true / /section section name=theirs src=index/nav/theirs keep=false subsection name=small src=index/nav/theirs/smalltheirs keep=true / subsection name=medium src=index/nav/theirs/mediumtheirs keep=true / subsection name=large src=index/nav/theirs/largetheirs keep=true / /section section name=contact src=index/nav/contact keep=true / /site -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of thomas horner Sent: 28 August 2009
[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) { site section name=about src=index/nav/about keep=false/ section name=hers src=index/nav/hers keep=false subsection name=small src=index/nav/hers/smalltheirs keep=true / subsection name=medium src=index/nav/hers/mediumtheirs keep=true / subsection name=large src=index/nav/hers/largetheirs keep=true / /section section name=his src=index/nav/his keep=false subsection name=small src=index/nav/his/smalltheirs keep=true / subsection name=medium src=index/nav/his/mediumtheirs keep=true / subsection name=large src=index/nav/his/largetheirs keep=true / /section section name=theirs src=index/nav/theirs keep=false subsection name=small src=index/nav/theirs/smalltheirs keep=true / subsection name=medium src=index/nav/theirs/mediumtheirs keep=true / subsection name=large src=index/nav/theirs/largetheirs keep=true / /section section name=contact src=index/nav/contact keep=true / /site ___ 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) { site section name=about src=index/nav/about keep=false/ section name=hers src=index/nav/hers keep=false subsection name=small src=index/nav/hers/smalltheirs keep=true / subsection name=medium src=index/nav/hers/mediumtheirs keep=true / subsection name=large src=index/nav/hers/largetheirs keep=true / /section section name=his src=index/nav/his keep=false subsection name=small src=index/nav/his/smalltheirs keep=true / subsection name=medium src=index/nav/his/mediumtheirs keep=true / subsection name=large src=index/nav/his/largetheirs keep=true / /section section name=theirs src=index/nav/theirs keep=false subsection name=small src=index/nav/theirs/smalltheirs keep=true / subsection name=medium src=index/nav/theirs/mediumtheirs keep=true / subsection name=large src=index/nav/theirs/largetheirs keep=true / /section section name=contact src=index/nav/contact keep=true / /site ___ 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] 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] seeing is xml has children
im trying to build a dynamic menu from an xml file, i want to determin whether each node has children in order to then determine whether or not to build a submenu from that section, i have tried using the below code in the loop but it's tracing out true every time, var hasChildren:Boolean = xmlLabels.section.childNodes; trace(hasChildren); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] spacing horizontal dynamic xml menu textfields
Yup that is correct. X and width, Y and height. Good luck! Sid On Aug 25, 2009, at 3:36 PM, thomas horner wrote: Hi thanks, so this is for a vertical menu or positioning vertical textFields, i will try and adjust this for horizontal purposes and measure the width as opposed to the height then? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 14:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Hi Thomas, Try to do something like this and adjust it to your own needs; // When you are in a for loop, create new items and and try to measure the height of an item. // And position items vertically.You need to remember the previous item, the fastest way to do this is to have a runningY var declared outside the for loop with an initial value of zero. //See comments in code for further explanation. var runningY:Number = 0; var OFFSET_X:Number = 20; for (var index:int = 0; index 4 ; index++) { var _textheader:TextField = new TextField( ); _textheader.text = Text; _textheader.autoSize = TextFieldAutoSize.LEFT; _textheader.x = _background.x - _background.width / 2 + OFFSET_X; // First iteration runningY = 0; // Second iteration runningY = 0 + textHeader.height +2; textHeader.height = 20 // Third iteration runningY = 22 + textHeader.height +2; textHeader.height = 40 -- mutiple lines of text // Fourth iteration runningY = 64 + textHeader.height +2; textHeader.height = 20 // Fifth iteration runningY = 86 _textheader.y = runningY; runningY += _textheader.height + 2; // textheader = 20 } On Aug 25, 2009, at 3:06 PM, thomas horner wrote: Hi all am struggling to position, my textFields generated within my loop from my external xml, i want to evenly space them and as they are dynamic they are all of different sizes. i have run a trace on the loop as follows; trace(navbut.label.width); which gives me the widths of each field how do it add the total of the widths from the loop? to then space them. ___ 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 ___ 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 -- Hire me to do your website, businesscards, presentations or flyers. -- Only those who dare to fail greatly can ever achieve greatly. - Robert F. Kennedy -- Sidney de Koning | Flash Developer/Creative Soul/Multimedialist Funky Monkey Studios | Van Ostadestraat 286 HS | 1073 TW | Amsterdam | e:sid...@funky-monkey.nl | tel: +31(06)24 548336 | fax: +31 (0)84 747 7288 ___ 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 -- Hire me to do your website, businesscards, presentations or flyers. -- Only those who dare to fail greatly can ever achieve greatly. - Robert F. Kennedy -- Sidney de Koning | Flash Developer/Creative Soul/Multimedialist Funky Monkey Studios | Van Ostadestraat 286 HS | 1073 TW | Amsterdam | e:sid...@funky-monkey.nl | tel: +31(06)24 548336 | fax: +31 (0)84 747 7288 ___ 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] spacing horizontal dynamic xml menu textfields
thanks steven, again! i had already managed to get the sids version going inside my build, but was just getting problems with adding spacing between them. for some reason now though all my buttons are acting as one when i mouseOver, siteNav=IXml(assets.siteNav).xml; var runningX:Number=0; var padding:Number=50; var itemsArr:Array=new Array(sitenav.secti...@name); for (var index:int = 0; index itemsArr.length; index++) { // You create items of any kind you like... var navbut:navItem = new navItem( ); //assign the menu text from the navxml navbut.label.text=itemsArr[index]; navbut.label.autoSize=TextFieldAutoSize.LEFT; //Assign an url to a menu item navbut.linkto=sitenav.secti...@src; //read instructions fomr nav xml navbut.keepopen=sitenav.secti...@keep; navbut.isclicked=sitenav.secti...@highlight; //Make the button look like a button (hand cursor) navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=sitenav.secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); //Add event handlers (used for animating the buttons) navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); // You say that runningX is some value. since it was zero in the beginning we are adding the value ontop of its current value (see line below) navbut.x=runningX; // ... And then you space them. You can use textWidth if using text width or plain width for object that extend from DisplayObjects or Sprites etc... runningX+=navbut.textWidth+padding;// +10 is the offset between the items you want ot use. Can be any number. // And then you add the child to the display list so it becomes visible. nav1.addChild(navbut); trace(runningX); } } function mouseClickHandler(e:Event):void { } function mouseOverHandler(e:Event):void { TweenMax.to(e.target, 0.25, {tint:0x88}) } function mouseOutHandler (e:Event):void { if (e.target.alpha 1) { TweenMax.to(e.target, 0.25, { alpha:0.3 } ) } else { //do nothing } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Steven Sacks Sent: 26 August 2009 09:53 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields As I described on my forum post, you have to first put your items in an array. var items:Array = [all, of, your, items]; var len:int= items.length; var i:int; Then, you do the following measurements: // the right of the last item minus the left of the first item var availableWidth:Number = items[len - 1].x + items[len -1].width - items[0].x; // the total widths of all the items var totalWidth:Number = 0; i = len; while (i--) { totalWidth += items[i].textWidth; } //Subtract the totalWidth from availableWidth to get the remainingWidth var remainingWidth:Number = availableWidth - totalWidth; // Divide remainingWidthby the number of items var gapWidth:Number = remainingWidth / len; // iterate through your array setting the x positions // of the items based on the previous item's width and the gap. var lastX:Number = 0; for (i= 0; i len; ++i) { items[i].x = lastX; lastX = items[i].textWidth + gapWidth; } // That's all there is to it. ___ 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] spacing horizontal dynamic xml menu textfields
Hi Sid for some reason that still doesn't work, it's not spacing the buttons out, it also seems to be treating all the buttons as just one button, and when i trace out the value of runningX it only gives me one value, any ideas, many thanks again, Thomas siteNav=IXml(assets.siteNav).xml; var runningX:Number=0; var padding:Number=50; var itemsArr:Array=new Array(sitenav.secti...@name); for (var index:int = 0; index itemsArr.length; index++) { // You create items of any kind you like... var navbut:navItem = new navItem( ); //assign the menu text from the navxml navbut.label.text=itemsArr[index]; navbut.label.autoSize=TextFieldAutoSize.LEFT; //Assign an url to a menu item navbut.linkto=sitenav.secti...@src; //read instructions fomr nav xml navbut.keepopen=sitenav.secti...@keep; navbut.isclicked=sitenav.secti...@highlight; //Make the button look like a button (hand cursor) navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=sitenav.secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); //Add event handlers (used for animating the buttons) navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); // You say that runningX is some value. since it was zero in the beginning we are adding the value ontop of its current value (see line below) navbut.x=runningX; // ... And then you space them. You can use textWidth if using text width or plain width for object that extend from DisplayObjects or Sprites etc... runningX+=navbut.width + 10;// +10 is the offset between the items you want ot use. Can be any number. // And then you add the child to the display list so it becomes visible. nav1.addChild(navbut); trace(runningX); } } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 26 August 2009 10:42 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Hi Thomas, In the nav item objects you are creating you can override the width and height functions, like so; override public function get width( ):Number { // The plus 4 makes it look better, change this if you like return _myTextfield.textWidth + 4; } Then it will all have a different width. Oh i just see that you have to use width since navItem is not a textfield, but uses a textfield so it does not have the textWidth funtion. Try that :) runningX += navItem.width + 20; Oh and just a (real important) note, it is very good practice to always create classes with a capital letter, so it then becomes NavItem instead of navItem. Cheers, Sid On Aug 26, 2009, at 10:28 AM, thomas horner wrote: Hi Sid many thanks for the demo, have managed to incorporate this successfully into what I was doing, and evenly space the items, but am struggling to space the items, as per line; runningX += textheader.textwidth + 20; //20 is the offset or padding between the items, however for some reason there is no gap and all the items are butted up to one another? many thanks, in advance , Thomas -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning - Funky Monkey Studios Sent: 25 August 2009 16:44 To: Flash Coders List Subject: RE: [Flashcoders] spacing horizontal dynamic xml menu textfields He Thomas, This stuff can be a bit difficult when making the transition. Textfield has a really cool property called textWidth and textHeight, that retruns only the width and height of the actual height :) I have put comment in the code that explain it. Here is an example to demo: var runningX:Number = 0; // This is basically your data comming from XML var itemsArr:Array = new Array(one, different length, piece of text, last bit, evently spaced); // It does not really matter
RE: [Flashcoders] spacing horizontal dynamic xml menu textfields
thanks steven but where in this do i populate my textfield in order to calculate the widths? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Steven Sacks Sent: 26 August 2009 09:53 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields As I described on my forum post, you have to first put your items in an array. var items:Array = [all, of, your, items]; var len:int= items.length; var i:int; Then, you do the following measurements: // the right of the last item minus the left of the first item var availableWidth:Number = items[len - 1].x + items[len -1].width - items[0].x; // the total widths of all the items var totalWidth:Number = 0; i = len; while (i--) { totalWidth += items[i].textWidth; } //Subtract the totalWidth from availableWidth to get the remainingWidth var remainingWidth:Number = availableWidth - totalWidth; // Divide remainingWidthby the number of items var gapWidth:Number = remainingWidth / len; // iterate through your array setting the x positions // of the items based on the previous item's width and the gap. var lastX:Number = 0; for (i= 0; i len; ++i) { items[i].x = lastX; lastX = items[i].textWidth + gapWidth; } // That's all there is to it. ___ 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] determining whether or not xml has children
have created a dynamic menu, kind off, with a hell of a lot of help and have positioned it evenly. i am trying to determine when a person clicks on the inital button whether that branch of the xml has children and therefore bring up the corresponding submenu for that section. below is my code; and below that my xml file. thanks in advance! public function createnavItem():void { //var i:uint=0; //var navbut:navItem; siteNav=IXml(assets.siteNav).xml; var runningX:Number=0; var itemsArr:Array=new Array(sitenav.secti...@name); var xmlLabels:xmllist=sitenav.secti...@name; trace(sitenav.section.subsecti...@name); var labelsArray:Array /* of String */ = new Array(xmlLabels.length); var t:int=0; for each (var labelText:String in xmlLabels) { labelsArray[t++]=labelText; var navbut:navItem = new navItem( ); navbut.label.text=labelText; navbut.label.autoSize=TextFieldAutoSize.LEFT; navbut.linkto=sitenav.secti...@src; //read instructions fomr nav xml navbut.keepopen=sitenav.secti...@keep; navbut.isclicked=sitenav.secti...@highlight; //Make the button look like a button (hand cursor) navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=sitenav.secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); navbut.x=runningX; runningX+=navbut.width+10; navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); nav1.addChild(navbut); } } function mouseClickHandler(e:MouseEvent):void { TweenMax.to(e.target, 0.25, {tint:0xF19E8B}); var page:String = e.target.label.text; } my xml file; site section name=about src=index/nav/about keep=false/ section name=hers src=index/nav/hers keep=false subsection name=small src=index/nav/hers/smalltheirs keep=true / subsection name=medium src=index/nav/hers/mediumtheirs keep=true / subsection name=large src=index/nav/hers/largetheirs keep=true / /section section name=his src=index/nav/his keep=false subsection name=small src=index/nav/his/smalltheirs keep=true / subsection name=medium src=index/nav/his/mediumtheirs keep=true / subsection name=large src=index/nav/his/largetheirs keep=true / /section section name=theirs src=index/nav/theirs keep=false subsection name=small src=index/nav/theirs/smalltheirs keep=true / subsection name=medium src=index/nav/theirs/mediumtheirs keep=true / subsection name=large src=index/nav/theirs/largetheirs keep=true / /section section name=contact src=index/nav/contact keep=true / /site ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] spacing horizontal dynamic xml menu textfields
Hi all am struggling to position, my textFields generated within my loop from my external xml, i want to evenly space them and as they are dynamic they are all of different sizes. i have run a trace on the loop as follows; trace(navbut.label.width); which gives me the widths of each field how do it add the total of the widths from the loop? to then space them. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] spacing horizontal dynamic xml menu textfields
Hi thanks, so this is for a vertical menu or positioning vertical textFields, i will try and adjust this for horizontal purposes and measure the width as opposed to the height then? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 14:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Hi Thomas, Try to do something like this and adjust it to your own needs; // When you are in a for loop, create new items and and try to measure the height of an item. // And position items vertically.You need to remember the previous item, the fastest way to do this is to have a runningY var declared outside the for loop with an initial value of zero. //See comments in code for further explanation. var runningY:Number = 0; var OFFSET_X:Number = 20; for (var index:int = 0; index 4 ; index++) { var _textheader:TextField = new TextField( ); _textheader.text = Text; _textheader.autoSize = TextFieldAutoSize.LEFT; _textheader.x = _background.x - _background.width / 2 + OFFSET_X; // First iteration runningY = 0; // Second iteration runningY = 0 + textHeader.height +2; textHeader.height = 20 // Third iteration runningY = 22 + textHeader.height +2; textHeader.height = 40 -- mutiple lines of text // Fourth iteration runningY = 64 + textHeader.height +2; textHeader.height = 20 // Fifth iteration runningY = 86 _textheader.y = runningY; runningY += _textheader.height + 2; // textheader = 20 } On Aug 25, 2009, at 3:06 PM, thomas horner wrote: Hi all am struggling to position, my textFields generated within my loop from my external xml, i want to evenly space them and as they are dynamic they are all of different sizes. i have run a trace on the loop as follows; trace(navbut.label.width); which gives me the widths of each field how do it add the total of the widths from the loop? to then space them. ___ 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] spacing horizontal dynamic xml menu textfields
is this using as2 as im trying to do it in as3 so am a bit confused -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 15:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Yup that is correct. X and width, Y and height. Good luck! Sid On Aug 25, 2009, at 3:36 PM, thomas horner wrote: Hi thanks, so this is for a vertical menu or positioning vertical textFields, i will try and adjust this for horizontal purposes and measure the width as opposed to the height then? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 14:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Hi Thomas, Try to do something like this and adjust it to your own needs; // When you are in a for loop, create new items and and try to measure the height of an item. // And position items vertically.You need to remember the previous item, the fastest way to do this is to have a runningY var declared outside the for loop with an initial value of zero. //See comments in code for further explanation. var runningY:Number = 0; var OFFSET_X:Number = 20; for (var index:int = 0; index 4 ; index++) { var _textheader:TextField = new TextField( ); _textheader.text = Text; _textheader.autoSize = TextFieldAutoSize.LEFT; _textheader.x = _background.x - _background.width / 2 + OFFSET_X; // First iteration runningY = 0; // Second iteration runningY = 0 + textHeader.height +2; textHeader.height = 20 // Third iteration runningY = 22 + textHeader.height +2; textHeader.height = 40 -- mutiple lines of text // Fourth iteration runningY = 64 + textHeader.height +2; textHeader.height = 20 // Fifth iteration runningY = 86 _textheader.y = runningY; runningY += _textheader.height + 2; // textheader = 20 } On Aug 25, 2009, at 3:06 PM, thomas horner wrote: Hi all am struggling to position, my textFields generated within my loop from my external xml, i want to evenly space them and as they are dynamic they are all of different sizes. i have run a trace on the loop as follows; trace(navbut.label.width); which gives me the widths of each field how do it add the total of the widths from the loop? to then space them. ___ 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 ___ 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] spacing horizontal dynamic xml menu textfields
im using it with in the gaia framework do you know it? below is my loop and 'navbut.x' is what im trying to find, i need to add all the widths of all the dynamic textfields sequentially and then space them out evenly horizontally , im just totally stuck! for each (var section:XML in siteNav.section) { navbut = new navItem(); navbut.label.autoSize=TextFieldAutoSize.LEFT; //Insert the menu text (li...@name reads the link's name attribute) navbut.label.text=secti...@name; //Assign an url to a menu item navbut.linkto=secti...@src; navbut.keepopen=secti...@keep; navbut.isclicked=secti...@highlight; //Insert the menu button to stage navbut.y=0; trace(total); navbut.x= ?; nav1.addChild(navbut); //Make the button look like a button (hand cursor) navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); //Add event handlers (used for animating the buttons) navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); //trace(navbut.x); //Increment the menu button counter, so we know how many buttons there are i++; } } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning - Funky Monkey Studios Sent: 25 August 2009 15:52 To: Flash Coders List Subject: RE: [Flashcoders] spacing horizontal dynamic xml menu textfields No problem :) This is using AS3. Where do you have problem with? Sid is this using as2 as im trying to do it in as3 so am a bit confused -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 15:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Yup that is correct. X and width, Y and height. Good luck! Sid On Aug 25, 2009, at 3:36 PM, thomas horner wrote: Hi thanks, so this is for a vertical menu or positioning vertical textFields, i will try and adjust this for horizontal purposes and measure the width as opposed to the height then? -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 14:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Hi Thomas, Try to do something like this and adjust it to your own needs; // When you are in a for loop, create new items and and try to measure the height of an item. // And position items vertically.You need to remember the previous item, the fastest way to do this is to have a runningY var declared outside the for loop with an initial value of zero. //See comments in code for further explanation. var runningY:Number = 0; var OFFSET_X:Number = 20; for (var index:int = 0; index 4 ; index++) { var _textheader:TextField = new TextField( ); _textheader.text = Text; _textheader.autoSize = TextFieldAutoSize.LEFT; _textheader.x = _background.x - _background.width / 2 + OFFSET_X; // First iteration runningY = 0; // Second iteration runningY = 0 + textHeader.height +2; textHeader.height = 20 // Third iteration runningY = 22 + textHeader.height +2; textHeader.height = 40 -- mutiple lines of text // Fourth iteration runningY = 64 + textHeader.height +2; textHeader.height = 20 // Fifth iteration runningY = 86 _textheader.y = runningY; runningY += _textheader.height + 2; // textheader = 20 } On Aug 25, 2009, at 3:06 PM, thomas horner wrote: Hi all am struggling to position, my textFields generated within my loop from my external xml, i want to evenly space them and as they are dynamic they are all of different sizes. i have run a trace on the loop as follows; trace(navbut.label.width); which
RE: [Flashcoders] spacing horizontal dynamic xml menu textfields
that looks fantastic sid, try and crack on with it this evening many thanks in advance! cheers, Thomas -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning - Funky Monkey Studios Sent: 25 August 2009 16:44 To: Flash Coders List Subject: RE: [Flashcoders] spacing horizontal dynamic xml menu textfields He Thomas, This stuff can be a bit difficult when making the transition. Textfield has a really cool property called textWidth and textHeight, that retruns only the width and height of the actual height :) I have put comment in the code that explain it. Here is an example to demo: var runningX:Number = 0; // This is basically your data comming from XML var itemsArr:Array = new Array(one, different length, piece of text, last bit, evently spaced); // It does not really matter what kind of loop you do, it is the way of spacing them thst matters, so you can do your loop like you normally would, // here i'm just using an array to demonstrate for (var index:int = 0; index itemsArr.length ; index++) { // You create items of any kind you like... var _textheader:TextField = new TextField( ); _textheader.text = itemsArr[index]; _textheader.autoSize = TextFieldAutoSize.LEFT; // You say that runningX is some value. since it was zero in the beginning we are adding the value ontop of its current value (see line below) _textheader.x = runningX; // ... And then you space them. You can use textWidth if using text width or plain width for object that extend from DisplayObjects or Sprites etc... runningX += _textheader.textWidth + 20; // +10 is the offset between the items you want ot use. Can be any number. // And then you add the child to the display list so it becomes visible. addChild(_textheader); } Any questions, just ask :) Cheers, Sid im using it with in the gaia framework do you know it? below is my loop and 'navbut.x' is what im trying to find, i need to add all the widths of all the dynamic textfields sequentially and then space them out evenly horizontally , im just totally stuck! for each (var section:XML in siteNav.section) { navbut = new navItem(); navbut.label.autoSize=TextFieldAutoSize.LEFT; //Insert the menu text (li...@name reads the link's name attribute) navbut.label.text=secti...@name; //Assign an url to a menu item navbut.linkto=secti...@src; navbut.keepopen=secti...@keep; navbut.isclicked=secti...@highlight; //Insert the menu button to stage navbut.y=0; trace(total); navbut.x= ?; nav1.addChild(navbut); //Make the button look like a button (hand cursor) navbut.buttonMode=true; navbut.mouseChildren=false; navbut.alpha=0; navbut.name=secti...@url; TweenMax.to(navbut, 0.5, {alpha:1}); //Add event handlers (used for animating the buttons) navbut.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler); navbut.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler); navbut.addEventListener(MouseEvent.CLICK, mouseClickHandler); //trace(navbut.x); //Increment the menu button counter, so we know how many buttons there are i++; } } -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning - Funky Monkey Studios Sent: 25 August 2009 15:52 To: Flash Coders List Subject: RE: [Flashcoders] spacing horizontal dynamic xml menu textfields No problem :) This is using AS3. Where do you have problem with? Sid is this using as2 as im trying to do it in as3 so am a bit confused -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Sidney de Koning Sent: 25 August 2009 15:22 To: Flash Coders List Subject: Re: [Flashcoders] spacing horizontal dynamic xml menu textfields Yup that is correct. X and width, Y and height. Good luck! Sid On Aug 25, 2009, at 3:36 PM, thomas horner wrote: Hi thanks, so this is for a vertical menu or positioning vertical textFields, i will try and adjust this for horizontal purposes and measure the width as opposed