Re: [Flashcoders] AS3 accessing functions from other classes
Hi Jason thanks for your help! Ive added what you said but the event listeners do not seam to to be hearing the dispatched event. main_site is the document class for main_site.fla, and is loaded into 'gallery.swf' using this code... // CODE from within FUNCTION var swfLoader:Loader = new Loader(); var swfURL:URLRequest = new URLRequest(filename); swfLoader.load (swfURL); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete); // CODE from within 'swfLoadComplete' FUNCTION addChild(ev.target.content); var loader:LoaderInfo = LoaderInfo(ev.target); loader.content.x = 0; loader.content.y = 0; ive tried adding these but they do not work loader.content.name = main_site; ...and... loader.content.instanceName = main_site; The EventDispatcher is imported (the whole import flash.events.*; are imported). Thanks SJM - Original Message - From: Merrill, Jason To: Flash Coders List Sent: Wednesday, August 13, 2008 10:14 PM Subject: RE: [Flashcoders] AS3 accessing functions from other classes Is main_site the name of the instance? It doesn't seem like it if you are getting that error. Does it also import EventDispatcher or at least, extend it? Depending on where the code sits, you could do: this.addEventListener instead of main_site - main_site should be an instance name - you cannot listen to events from non-instances. Jason Merrill Bank of America Enterprise Technology Global Risk LLD Instructional Technology Media Join the Bank of America Flash Platform Developer Community Are you a Bank of America associate interested in innovative learning ideas and technologies? Check out our internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM - Flash Sent: Wednesday, August 13, 2008 1:47 PM To: Flash Coders List Subject: Re: [Flashcoders] AS3 accessing functions from other classes Hi Eduardo, thanks for your help! Ive implimented this into my code but still does not work, i now get a couple of errors... Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(bk2globe, bk2globeListener); Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(randomImg, randomImgListener); here is my code * * * * * * * * * * main_site.as dispatchEvent(new Event(bk2globe)); dispatchEvent(new Event(randomImg)); * * * * * * * * * * gallery.as main_site.addEventListener(bk2globe, bk2globeListener); main_site.addEventListener(randomImg, randomImgListener); private function bk2globeListener(ev:Event):void { goBackToMain(); } private function randomImgListener(ev:Event):void { loadPhoto(randRange(1, 52)); } * * * * * * * * * * Thanks SJM - Original Message - From: Eduardo Omine To: Flash Coders List Sent: Wednesday, August 13, 2008 6:19 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes Dispatch an event from the loaded SWF and let the parent SWF handle the action. * * * * * * * * * * MainSite.as dispatchEvent(new Event(myEventName)); * * * * * * * * * * Gallery.as mainSite.addEventListener(myEventName, myListener); private function myListener(e:Event):void { // call desired method here } * * * * * * * * * * HTH -- Eduardo Omine http://blog.omine.net/ http://www.omine.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 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] AS3 accessing functions from other classes
doing it this way creates a load of problems! Thanks for your help! SJM - Original Message - From: H To: Flash Coders List Sent: Thursday, August 14, 2008 12:19 AM Subject: Re: [Flashcoders] AS3 accessing functions from other classes Call to a possibly undefined method addEventListener through a reference with static type Class I think you're calling these methods on the Class main_site. Try this: var main_site_instance:main_site = new main_site(); main_site_instance.addEventListener(bk2globe, bk2globeListener); But, if you are having trouble with this, grab a copy of actionscript 3.0 essentials http://www.amazon.com/Essential-ActionScript-3-0/dp/0596526946. Here is a short article that might help you: http://www.adobe.com/devnet/flash/quickstart/creating_class_as3/ Keep at it! H On Wed, Aug 13, 2008 at 4:14 PM, Merrill, Jason [EMAIL PROTECTED] wrote: Is main_site the name of the instance? It doesn't seem like it if you are getting that error. Does it also import EventDispatcher or at least, extend it? Depending on where the code sits, you could do: this.addEventListener instead of main_site - main_site should be an instance name - you cannot listen to events from non-instances. Jason Merrill Bank of America Enterprise Technology Global Risk LLD Instructional Technology Media Join the Bank of America Flash Platform Developer Community Are you a Bank of America associate interested in innovative learning ideas and technologies? Check out our internal GTO Innovative Learning Blog subscribe. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM - Flash Sent: Wednesday, August 13, 2008 1:47 PM To: Flash Coders List Subject: Re: [Flashcoders] AS3 accessing functions from other classes Hi Eduardo, thanks for your help! Ive implimented this into my code but still does not work, i now get a couple of errors... Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(bk2globe, bk2globeListener); Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(randomImg, randomImgListener); here is my code * * * * * * * * * * main_site.as dispatchEvent(new Event(bk2globe)); dispatchEvent(new Event(randomImg)); * * * * * * * * * * gallery.as main_site.addEventListener(bk2globe, bk2globeListener); main_site.addEventListener(randomImg, randomImgListener); private function bk2globeListener(ev:Event):void { goBackToMain(); } private function randomImgListener(ev:Event):void { loadPhoto(randRange(1, 52)); } * * * * * * * * * * Thanks SJM - Original Message - From: Eduardo Omine To: Flash Coders List Sent: Wednesday, August 13, 2008 6:19 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes Dispatch an event from the loaded SWF and let the parent SWF handle the action. * * * * * * * * * * MainSite.as dispatchEvent(new Event(myEventName)); * * * * * * * * * * Gallery.as mainSite.addEventListener(myEventName, myListener); private function myListener(e:Event):void { // call desired method here } * * * * * * * * * * HTH -- Eduardo Omine http://blog.omine.net/ http://www.omine.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 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] AS3 accessing functions from other classes
Again another solution i tried but this too does not work! Thanks SJM - Original Message - From: Kenneth Kawamoto To: Flash Coders List Sent: Thursday, August 14, 2008 1:36 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes You should be able to do access the parent by using, parent. Kenneth Kawamoto http://www.materiaprima.co.uk/ SJM - Flash wrote: Hi guys, im having some trouble accessing a function from another class and I would like to know how its done. In my project i have 2 FLAs 'gallery.fla' and 'main_site.fla', each of the FLAs has its own document class 'gallery.as' and 'main_site.as'. When compiled the second SWF(main_site) is loaded into the first SWF(gallery). In the same class that loads the SWF there is a number of other functions i want to access from buttons located within the loaded SWF (main_site). The SWF is loaded using this code... // CODE from within FUNCTION var swfLoader:Loader = new Loader(); var swfURL:URLRequest = new URLRequest(filename); swfLoader.load (swfURL); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete); // CODE from within 'swfLoadComplete' FUNCTION addChild(ev.target.content); var loader:LoaderInfo = LoaderInfo(ev.target); loader.content.x = 0; loader.content.y = 0; SJM ___ 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] AS3 accessing functions from other classes
Kenneth i get... [object Loader] when tracing parent SJM - Original Message - From: Kenneth Kawamoto To: Flash Coders List Sent: Thursday, August 14, 2008 2:11 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes What do you get if you do trace(parent);? Kenneth Kawamoto http://www.materiaprima.co.uk/ SJM - Flash wrote: Again another solution i tried but this too does not work! Thanks SJM - Original Message - *From:* Kenneth Kawamoto mailto:[EMAIL PROTECTED] *To:* Flash Coders List mailto:flashcoders@chattyfig.figleaf.com *Sent:* Thursday, August 14, 2008 1:36 PM *Subject:* Re: [Flashcoders] AS3 accessing functions from other classes You should be able to do access the parent by using, parent. Kenneth Kawamoto http://www.materiaprima.co.uk/ SJM - Flash wrote: Hi guys, im having some trouble accessing a function from another class and I would like to know how its done. In my project i have 2 FLAs 'gallery.fla' and 'main_site.fla', each of the FLAs has its own document class 'gallery.as' and 'main_site.as'. When compiled the second SWF(main_site) is loaded into the first SWF(gallery). In the same class that loads the SWF there is a number of other functions i want to access from buttons located within the loaded SWF (main_site). The SWF is loaded using this code... // CODE from within FUNCTION var swfLoader:Loader = new Loader(); var swfURL:URLRequest = new URLRequest(filename); swfLoader.load (swfURL); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete); // CODE from within 'swfLoadComplete' FUNCTION addChild(ev.target.content); var loader:LoaderInfo = LoaderInfo(ev.target); loader.content.x = 0; loader.content.y = 0; SJM ___ 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] AS3 - Applying a skin to loaded FLV
Hi guys, ive written some code to load FLVs into flash and then play them. The problem is that the skin does not seam to be working! Here is teh code to load teh FLV private function loadFLV (filename:String):void { connect = new NetConnection(); // builds new net connextion flash media connect.connect(null); // Stop it from conecting to flash server stream = new NetStream(connect); // attaches the stream service to connection flashVideo = new Video(); // Create new video object this.addChild(flashVideo); // Adds new video child flashVideo.attachNetStream(stream); // attach connection to video stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, handleError); // Error info listener stream.bufferTime = 1; stream.receiveVideo(true); stream.client = this; flashVideo.visible = false; stream.play(myvideo.flv); // start downloading } public function onMetaData(infoObject:Object):void { if(infoObject.duration != null) { trace(our video is +infoObject.duration+ seconds long); } if(infoObject.height != null infoObject.width != null) { trace(our video is +infoObject.height+x+infoObject.width+ pixels); flashVideo.height = infoObject.height; flashVideo.width = infoObject.width; flashVideo.x = (stage.stageWidth - flashVideo.width) * 0.5; flashVideo.y = (475 - flashVideo.height) * 0.5; flashVideo.visible = true; } } Ive tried adding... flashVideo.skin = skin/FLVPlayer_Progressive.swf; but i get this error... 1119: Access of possibly undefined property skin through a reference with static type flash.media:Video. Ive tried adding... stream.skin = skin/FLVPlayer_Progressive.swf; but i get this error... 1119: Access of possibly undefined property skin through a reference with static type flash.net:NetStream. Can anyone tell mw how to easily apply the skin? SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 accessing functions from other classes
Think ive fixed my problems with this now! Many thjanks for your help! SJM - Original Message - From: H To: Flash Coders List Sent: Thursday, August 14, 2008 2:30 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes Sorry man I didn't read the original post :S ... main_site is loaded into gallery, and main_site has some buttons that when you press them, they should trigger handlers in gallery. I think it goes like this - add this code to your loader complete function in gallery: //where target is Loader var main_site_instance:Sprite = ev.target.content as Sprite; main_site_instance.addEventListener(bk2globe, bk2globeListener); main_site_instance.addEventListener(randomImg, randomImgListener); main_site should dispatch these events when you interact with it. This needs to happen on the document class level... H On Thu, Aug 14, 2008 at 8:55 AM, SJM - Flash [EMAIL PROTECTED] wrote: Again another solution i tried but this too does not work! Thanks SJM - Original Message - From: Kenneth Kawamoto To: Flash Coders List Sent: Thursday, August 14, 2008 1:36 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes You should be able to do access the parent by using, parent. Kenneth Kawamoto http://www.materiaprima.co.uk/ SJM - Flash wrote: Hi guys, im having some trouble accessing a function from another class and I would like to know how its done. In my project i have 2 FLAs 'gallery.fla' and 'main_site.fla', each of the FLAs has its own document class 'gallery.as' and 'main_site.as'. When compiled the second SWF(main_site) is loaded into the first SWF(gallery). In the same class that loads the SWF there is a number of other functions i want to access from buttons located within the loaded SWF (main_site). The SWF is loaded using this code... // CODE from within FUNCTION var swfLoader:Loader = new Loader(); var swfURL:URLRequest = new URLRequest(filename); swfLoader.load (swfURL); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete); // CODE from within 'swfLoadComplete' FUNCTION addChild(ev.target.content); var loader:LoaderInfo = LoaderInfo(ev.target); loader.content.x = 0; loader.content.y = 0; SJM ___ 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] AS3 accessing functions from other classes
Hi guys, im having some trouble accessing a function from another class and I would like to know how its done. In my project i have 2 FLAs 'gallery.fla' and 'main_site.fla', each of the FLAs has its own document class 'gallery.as' and 'main_site.as'. When compiled the second SWF(main_site) is loaded into the first SWF(gallery). In the same class that loads the SWF there is a number of other functions i want to access from buttons located within the loaded SWF (main_site). The SWF is loaded using this code... // CODE from within FUNCTION var swfLoader:Loader = new Loader(); var swfURL:URLRequest = new URLRequest(filename); swfLoader.load (swfURL); swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete); // CODE from within 'swfLoadComplete' FUNCTION addChild(ev.target.content); var loader:LoaderInfo = LoaderInfo(ev.target); loader.content.x = 0; loader.content.y = 0; SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 accessing functions from other classes
Hi Eduardo, thanks for your help! Ive implimented this into my code but still does not work, i now get a couple of errors... Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(bk2globe, bk2globeListener); Desc: 1061: Call to a possibly undefined method addEventListener through a reference with static type Class. Src: main_site.addEventListener(randomImg, randomImgListener); here is my code * * * * * * * * * * main_site.as dispatchEvent(new Event(bk2globe)); dispatchEvent(new Event(randomImg)); * * * * * * * * * * gallery.as main_site.addEventListener(bk2globe, bk2globeListener); main_site.addEventListener(randomImg, randomImgListener); private function bk2globeListener(ev:Event):void { goBackToMain(); } private function randomImgListener(ev:Event):void { loadPhoto(randRange(1, 52)); } * * * * * * * * * * Thanks SJM - Original Message - From: Eduardo Omine To: Flash Coders List Sent: Wednesday, August 13, 2008 6:19 PM Subject: Re: [Flashcoders] AS3 accessing functions from other classes Dispatch an event from the loaded SWF and let the parent SWF handle the action. * * * * * * * * * * MainSite.as dispatchEvent(new Event(myEventName)); * * * * * * * * * * Gallery.as mainSite.addEventListener(myEventName, myListener); private function myListener(e:Event):void { // call desired method here } * * * * * * * * * * HTH -- Eduardo Omine http://blog.omine.net/ http://www.omine.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] AS3/Papervision - rotating 3d object with 'hot' areas
Hi Guys im fishing for information on the best way to create a rotating 3d object with 'hot' areas what you can roll over to revel a description. Here is an example... http://www.danzer.ltd.uk/linkpakSpec.htm Instead of frame by frame (like the example) i want to create a fully dynamic 3d version using swift3d papervision, any examples of similar projects, links to tutorials general advice would me much appreciated! Thanks SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3/Papervision - rotating 3d object with 'hot'areas
Already have, seams to be a little slow in replying! SJM - Original Message - From: Ian Thomas To: Flash Coders List Sent: Monday, July 21, 2008 2:00 PM Subject: Re: [Flashcoders] AS3/Papervision - rotating 3d object with 'hot'areas Hi SJM, I'd suggest you ask on the Papervision list: http://osflash.org/mailman/listinfo/papervision3d_osflash.org HTH, Ian On Mon, Jul 21, 2008 at 1:55 AM, SJM - Flash [EMAIL PROTECTED] wrote: Hi Guys im fishing for information on the best way to create a rotating 3d object with 'hot' areas what you can roll over to revel a description. Here is an example... http://www.danzer.ltd.uk/linkpakSpec.htm Instead of frame by frame (like the example) i want to create a fully dynamic 3d version using swift3d papervision, any examples of similar projects, links to tutorials general advice would me much appreciated! Thanks SJM ___ 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] AS3 - Problem with first item in Array
Hi Guys im having a bit of a nightmare with the first item in an array! For some reason when the flash file is first loaded it will not display any information related to the first item in the array! When the flash its reloaded it works fine! Any ideas? SJM - My code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; import flash.geom.Point; import fl.transitions.Tween; import fl.transitions.easing.*; import flash.filters.GlowFilter; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.display.StageScaleMode; public class mainClass extends MovieClip { // // Vars and Arrays // public var imageHolder:MovieClip; public var containerX:Number = (stage.stageWidth / 5); public var imgArray:Array = new Array(uploads/images/dev_xantium.jpg, uploads/images/dev_the-limes.jpg, uploads/images/dev_richmond-grove.jpg, uploads/images/dev_bridgewater-gardens.jpg, uploads/images/dev_gransmoor-gardens.jpg); public var linkArray:Array = new Array(xantium, the-limes, 57-richmond-grove, bridgewater-gardens, gransmoor-gardens); public var titleArray:Array = new Array(Xantium, The Limes, 57 Richmond Grove, Bridgewater Gardens, Gransmoor Gardens); public var mycontainer:Array = new Array(); public var imageMask:Array = new Array(); // // Start of mainClass // public function mainClass():void { for (var i:int = 0; i 5; i++) { create_MCs(i, containerX, imgArray[i]); containerX += (stage.stageWidth / 5) - 46; } } // // Create MCs // public function create_MCs(number:int, x:int, imgURL:String) { trace(imgURL); // Create Container MC mycontainer[number] = new MovieClip(); addChild(mycontainer[number]); // Create new DynamicImage MC to hold loaded image imageHolder = new DynamicImage(); imageHolder.file = imgURL; mycontainer[number].addChild(imageHolder); // Create mask MC and set mask to loaded image imageMask[number] = new MovieClip(); imageMask[number].graphics.beginFill(0xFF); imageMask[number].graphics.drawRect(-40, 0, 80, 200); imageMask[number].graphics.endFill(); mycontainer[number].addChild(imageMask[number]); // Set mask to loaded image imageHolder.mask = imageMask[number]; // Set name for loaded image mycontainer[number].name = number; // Add listeners and button info mycontainer[number].addEventListener(MouseEvent.MOUSE_OVER, mOver); mycontainer[number].addEventListener(MouseEvent.MOUSE_OUT, mOut); mycontainer[number].addEventListener(MouseEvent.CLICK, mClick); mycontainer[number].mouseChildren = false; mycontainer[number].buttonMode = true; // Set new X/Y for main container mycontainer[number].y = 40; mycontainer[number].x = x; // Set new X/Y for DynamicImage (containing image) imageHolder.x = - 100; imageHolder.y = 0; // Set new X/Y for image mask imageMask[number].y = 0; // Apply outer glow to containers var outerGlow:GlowFilter = new GlowFilter(0x00, // color:uint, 1,// alpha:Number 11.0, // blurX:Number 11.0, // blurY:Number 0.34, // strength:Number 3, // quality:int false, // inner:Boolean false); // knockout:Boolean mycontainer[number].filters = new Array(outerGlow); } // // Over/Out Click Mouse events // public function mOver(ev:MouseEvent):void { var tweener = imageMask[ev.target.name]; var overTween:Tween = new Tween (tweener,// obj:Object width,// prop:String Elastic.easeOut, // func:Function 80, // begin:Number 200, // finish:Number 2, // duration:Number true);// useSeconds:Boolean = false setChildIndex(mycontainer[ev.target.name], (numChildren - 1)); } public function mOut(ev:MouseEvent):void { var tweener = imageMask[ev.target.name]; var outTween:Tween = new Tween (tweener, width, Elastic.easeOut, 200, 80, 2, true); } public function mClick ( ev:MouseEvent ):void { goGetURL(index.php?page=+linkArray[ev.target.name
Re: [Flashcoders] AS3 - Problem with first item in Array
Thanks for the advice! - Original Message - From: jonathan howe To: Flash Coders List Sent: Thursday, July 17, 2008 6:31 PM Subject: Re: [Flashcoders] AS3 - Problem with first item in Array Hi, SJM, Hypothesis: Don't know if this is different for AS3 (couldn't find the appropriate documentation in a quick search) but I got into the habit of avoiding assigning values for declared variables in the class body unless they are static variables. My recommendation would be declare variables like your arrays in the class body: public var containerX:Number; And then initialize them in your mainClass() function containerX = (stage.stageWidth / 5); Otherwise you may get unpredictable results based on what's in memory at the time. -jonathan On Thu, Jul 17, 2008 at 7:08 PM, SJM - Flash [EMAIL PROTECTED] wrote: Hi Guys im having a bit of a nightmare with the first item in an array! For some reason when the flash file is first loaded it will not display any information related to the first item in the array! When the flash its reloaded it works fine! Any ideas? SJM - My code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; import flash.geom.Point; import fl.transitions.Tween; import fl.transitions.easing.*; import flash.filters.GlowFilter; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.display.StageScaleMode; public class mainClass extends MovieClip { // // Vars and Arrays // public var imageHolder:MovieClip; public var containerX:Number = (stage.stageWidth / 5); public var imgArray:Array = new Array(uploads/images/dev_xantium.jpg, uploads/images/dev_the-limes.jpg, uploads/images/dev_richmond-grove.jpg, uploads/images/dev_bridgewater-gardens.jpg, uploads/images/dev_gransmoor-gardens.jpg); public var linkArray:Array = new Array(xantium, the-limes, 57-richmond-grove, bridgewater-gardens, gransmoor-gardens); public var titleArray:Array = new Array(Xantium, The Limes, 57 Richmond Grove, Bridgewater Gardens, Gransmoor Gardens); public var mycontainer:Array = new Array(); public var imageMask:Array = new Array(); // // Start of mainClass // public function mainClass():void { for (var i:int = 0; i 5; i++) { create_MCs(i, containerX, imgArray[i]); containerX += (stage.stageWidth / 5) - 46; } } // // Create MCs // public function create_MCs(number:int, x:int, imgURL:String) { trace(imgURL); // Create Container MC mycontainer[number] = new MovieClip(); addChild(mycontainer[number]); // Create new DynamicImage MC to hold loaded image imageHolder = new DynamicImage(); imageHolder.file = imgURL; mycontainer[number].addChild(imageHolder); // Create mask MC and set mask to loaded image imageMask[number] = new MovieClip(); imageMask[number].graphics.beginFill(0xFF); imageMask[number].graphics.drawRect(-40, 0, 80, 200); imageMask[number].graphics.endFill(); mycontainer[number].addChild(imageMask[number]); // Set mask to loaded image imageHolder.mask = imageMask[number]; // Set name for loaded image mycontainer[number].name = number; // Add listeners and button info mycontainer[number].addEventListener(MouseEvent.MOUSE_OVER, mOver); mycontainer[number].addEventListener(MouseEvent.MOUSE_OUT, mOut); mycontainer[number].addEventListener(MouseEvent.CLICK, mClick); mycontainer[number].mouseChildren = false; mycontainer[number].buttonMode = true; // Set new X/Y for main container mycontainer[number].y = 40; mycontainer[number].x = x; // Set new X/Y for DynamicImage (containing image) imageHolder.x = - 100; imageHolder.y = 0; // Set new X/Y for image mask imageMask[number].y = 0; // Apply outer glow to containers var outerGlow:GlowFilter = new GlowFilter(0x00, // color:uint, 1,// alpha:Number 11.0, // blurX:Number 11.0, // blurY:Number 0.34, // strength:Number 3, // quality:int false
Re: [Flashcoders] AS3 - Problem with first item in Array
Hey Cor This is a continuation from the thing you were looking on Sunday for me! I took your advice and re-wrote most of the code! You will notice first time round it will trace all the correct info (5 image URLs) for the array but when you get to... trace(LOAD COMPLETE - +ev.target.content.name); It will only trace out 4 objects! --- DynamicImage package { import flash.display.MovieClip; import flash.display.Loader; import flash.net.URLRequest; import flash.events.Event; public class DynamicImage extends MovieClip { private var _file:String; public function set file (filename:String):void { // This is the function to set the file name this._file = filename; loadImage(); // // Start of Class // } public function DynamicImage() { } private function loadImage():void { var imageLoader:Loader = new Loader(); // Set loader try { var imageURL:URLRequest = new URLRequest(this._file); // Set file name imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete); trace(DI URL - +this._file); } catch (err:Error) { trace(No files are loading - +err); } } private function loadComplete(ev:Event):void { // Load image dynamicly trace(Image Being loaded); this.addChild(ev.target.content); trace(LOAD COMPLETE - +ev.target.content.name); } } } - Original Message - From: Cor To: 'Flash Coders List' Sent: Thursday, July 17, 2008 7:07 PM Subject: RE: [Flashcoders] AS3 - Problem with first item in Array What does your class DynamicImage look like? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM - Flash Sent: donderdag 17 juli 2008 19:08 To: Flash Coders List Subject: [Flashcoders] AS3 - Problem with first item in Array Hi Guys im having a bit of a nightmare with the first item in an array! For some reason when the flash file is first loaded it will not display any information related to the first item in the array! When the flash its reloaded it works fine! Any ideas? SJM - My code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; import flash.geom.Point; import fl.transitions.Tween; import fl.transitions.easing.*; import flash.filters.GlowFilter; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.display.StageScaleMode; public class mainClass extends MovieClip { // // Vars and Arrays // public var imageHolder:MovieClip; public var containerX:Number = (stage.stageWidth / 5); public var imgArray:Array = new Array(uploads/images/dev_xantium.jpg, uploads/images/dev_the-limes.jpg, uploads/images/dev_richmond-grove.jpg, uploads/images/dev_bridgewater-gardens.jpg, uploads/images/dev_gransmoor-gardens.jpg); public var linkArray:Array = new Array(xantium, the-limes, 57-richmond-grove, bridgewater-gardens, gransmoor-gardens); public var titleArray:Array = new Array(Xantium, The Limes, 57 Richmond Grove, Bridgewater Gardens, Gransmoor Gardens); public var mycontainer:Array = new Array(); public var imageMask:Array = new Array(); // // Start of mainClass // public function mainClass():void { for (var i:int = 0; i 5; i++) { create_MCs(i, containerX, imgArray[i]); containerX += (stage.stageWidth / 5) - 46; } } // // Create MCs // public function create_MCs(number:int, x:int, imgURL:String) { trace(imgURL); // Create Container MC mycontainer[number] = new MovieClip(); addChild(mycontainer[number]); // Create new DynamicImage MC to hold loaded image imageHolder = new DynamicImage(); imageHolder.file = imgURL; mycontainer[number].addChild(imageHolder); // Create mask MC and set mask to loaded image imageMask[number] = new MovieClip(); imageMask[number].graphics.beginFill(0xFF); imageMask[number].graphics.drawRect(-40, 0, 80, 200); imageMask[number].graphics.endFill
Re: [Flashcoders] AS3 - Problem with first item in Array
What's the real deal? Is there a reason it's better (or worse) to favor one practice over the other? Im new to AS3 so still learning from what ive been told you declare a static var here and any you want to update in the class body! - Original Message - From: Jim McIntyre To: Flash Coders List Sent: Thursday, July 17, 2008 7:11 PM Subject: Re: [Flashcoders] AS3 - Problem with first item in Array I got the impression from the AS2 documentation that one *should* set an initial value for a variable in the class body, as long as the initial value could be defined at compile time. http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Partsfile=1116.html However, I've seen many folks leave the value undefined by not assigning anything in the class body, like your example below. What's the real deal? Is there a reason it's better (or worse) to favor one practice over the other? -Jim jonathan howe wrote: Hi, SJM, Hypothesis: Don't know if this is different for AS3 (couldn't find the appropriate documentation in a quick search) but I got into the habit of avoiding assigning values for declared variables in the class body unless they are static variables. My recommendation would be declare variables like your arrays in the class body: public var containerX:Number; And then initialize them in your mainClass() function containerX = (stage.stageWidth / 5); Otherwise you may get unpredictable results based on what's in memory at the time. ___ 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] AS3 - Displaying images from a directory
how would i do this usined a pre-defined list or filename structure? can you point me to any examples? SJM - Original Message - From: Rich Shupe To: FlashCoders Sent: Tuesday, July 08, 2008 4:29 PM Subject: Re: [Flashcoders] AS3 - Displaying images from a directory these should all work: --FlashVar will work if you can edit the template (still no server-side required), --a list in a text or XML file where no server interaction is required but an external file is needed (should work unless your CMS radically alters your directory structure) --a pre-defined list or filename structure, as suggested (although I'd add error handling for the final failure) On 7/8/08 9:54 AM, SJM - Flash [EMAIL PROTECTED] wrote: My problem is the flash file is going to be embeded into a templete page to be added to a CMS unfortunatly there is no option for me to use any additional XML, PHP, ASP, Pearl script etc... the way i thought it would work is the path to the images would be a flash var! Rich http://www.LearningActionScript3.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] Wierd roleover problem! AS3
Hi Guys Im having a weird problem with a rollover, im trying to create a simple mouse_over/mouse out but for some reason the over and out do not work properly! I have 5 MC buttons on the main stage within each of the MCs is 4layers; layer 1 - a empty MC to load an image into, Layer 2 -shape tween set as a mask, Layer 3 - stop(); action and over/out labels Everything works fine upto the point when I attempt a mouse over initially it works fine but for some reason instead of stopping at the selected frame it disappears. The image loading file seams to work fine so here is my main AS file code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; public class mainClass extends MovieClip { // // Start of Class // public function mainClass():void { image1_mask.image1.file =images/image2.jpg; image2_mask.image2.file =images/image3.jpg; image3_mask.image3.file =images/image5.jpg; image4_mask.image4.file =images/image7.jpg; image5_mask.image5.file =images/image8.jpg; addOverOut(image1_mask); addOverOut(image2_mask); addOverOut(image3_mask); addOverOut(image4_mask); addOverOut(image5_mask); } public function addOverOut(mcName:MovieClip):void { mcName.addEventListener (MouseEvent.MOUSE_OVER, overHandler); mcName.addEventListener (MouseEvent.MOUSE_OUT, outHandler); mcName.addEventListener (MouseEvent.CLICK, clickHandler); mcName.mouseChildren = false; mcName.buttonMode = true; mcName.useHandCursor = true; } public function overHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(over); trace(OVER - + ev.target.name); } public function outHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(out); trace(OUT - + ev.target.name); } public function clickHandler ( ev:MouseEvent ):void { //first we need to determine which button was clicked var buttonName:String = ev.target.name; switch (buttonName) { case image1_mask: trace(Click Image 1); break; case image2_mask: trace(Click Image 2); break; case image3_mask: trace(Click Image 3); break; case image4_mask: trace(Click Image 4); break; case image5_mask: trace(Click Image 5); break; } } } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Wierd roleover problem! AS3
Thanks for your help! Ive uploaded the SWF as i can se the problem isnt easy to explain! http://79.170.40.163/flashdev.com/devgallery/development.swf SJM - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:07 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 You override your mcName 5 times, so only the last instance remains in focus. I guess, without knowing the rest of your application, in the function addOverOut add these lines as first lines: Var mc:MovieClip = new MovieClip(); mc = mcName; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 17:46 To: Flash Coders List Subject: [Flashcoders] Wierd roleover problem! AS3 Hi Guys Im having a weird problem with a rollover, im trying to create a simple mouse_over/mouse out but for some reason the over and out do not work properly! I have 5 MC buttons on the main stage within each of the MCs is 4layers; layer 1 - a empty MC to load an image into, Layer 2 -shape tween set as a mask, Layer 3 - stop(); action and over/out labels Everything works fine upto the point when I attempt a mouse over initially it works fine but for some reason instead of stopping at the selected frame it disappears. The image loading file seams to work fine so here is my main AS file code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; public class mainClass extends MovieClip { // // Start of Class // public function mainClass():void { image1_mask.image1.file =images/image2.jpg; image2_mask.image2.file =images/image3.jpg; image3_mask.image3.file =images/image5.jpg; image4_mask.image4.file =images/image7.jpg; image5_mask.image5.file =images/image8.jpg; addOverOut(image1_mask); addOverOut(image2_mask); addOverOut(image3_mask); addOverOut(image4_mask); addOverOut(image5_mask); } public function addOverOut(mcName:MovieClip):void { mcName.addEventListener (MouseEvent.MOUSE_OVER, overHandler); mcName.addEventListener (MouseEvent.MOUSE_OUT, outHandler); mcName.addEventListener (MouseEvent.CLICK, clickHandler); mcName.mouseChildren = false; mcName.buttonMode = true; mcName.useHandCursor = true; } public function overHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(over); trace(OVER - + ev.target.name); } public function outHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(out); trace(OUT - + ev.target.name); } public function clickHandler ( ev:MouseEvent ):void { //first we need to determine which button was clicked var buttonName:String = ev.target.name; switch (buttonName) { case image1_mask: trace(Click Image 1); break; case image2_mask: trace(Click Image 2); break; case image3_mask: trace(Click Image 3); break; case image4_mask: trace(Click Image 4); break; case image5_mask: trace(Click Image 5); break; } } } } ___ 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] Wierd roleover problem! AS3
basically the box is suppose to expand than contract on mouse out! - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:07 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 You override your mcName 5 times, so only the last instance remains in focus. I guess, without knowing the rest of your application, in the function addOverOut add these lines as first lines: Var mc:MovieClip = new MovieClip(); mc = mcName; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 17:46 To: Flash Coders List Subject: [Flashcoders] Wierd roleover problem! AS3 Hi Guys Im having a weird problem with a rollover, im trying to create a simple mouse_over/mouse out but for some reason the over and out do not work properly! I have 5 MC buttons on the main stage within each of the MCs is 4layers; layer 1 - a empty MC to load an image into, Layer 2 -shape tween set as a mask, Layer 3 - stop(); action and over/out labels Everything works fine upto the point when I attempt a mouse over initially it works fine but for some reason instead of stopping at the selected frame it disappears. The image loading file seams to work fine so here is my main AS file code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; public class mainClass extends MovieClip { // // Start of Class // public function mainClass():void { image1_mask.image1.file =images/image2.jpg; image2_mask.image2.file =images/image3.jpg; image3_mask.image3.file =images/image5.jpg; image4_mask.image4.file =images/image7.jpg; image5_mask.image5.file =images/image8.jpg; addOverOut(image1_mask); addOverOut(image2_mask); addOverOut(image3_mask); addOverOut(image4_mask); addOverOut(image5_mask); } public function addOverOut(mcName:MovieClip):void { mcName.addEventListener (MouseEvent.MOUSE_OVER, overHandler); mcName.addEventListener (MouseEvent.MOUSE_OUT, outHandler); mcName.addEventListener (MouseEvent.CLICK, clickHandler); mcName.mouseChildren = false; mcName.buttonMode = true; mcName.useHandCursor = true; } public function overHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(over); trace(OVER - + ev.target.name); } public function outHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(out); trace(OUT - + ev.target.name); } public function clickHandler ( ev:MouseEvent ):void { //first we need to determine which button was clicked var buttonName:String = ev.target.name; switch (buttonName) { case image1_mask: trace(Click Image 1); break; case image2_mask: trace(Click Image 2); break; case image3_mask: trace(Click Image 3); break; case image4_mask: trace(Click Image 4); break; case image5_mask: trace(Click Image 5); break; } } } } ___ 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] Wierd roleover problem! AS3
No not quite! I want the width of the MC to increase revealing more of the image, so I used a shape mask that is tweened! - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:31 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 Look at this: www.badmintonclubnetwerk.nl/_Cor/Dave Move over the buttons. Is this what you mean? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 18:27 To: Flash Coders List Subject: Re: [Flashcoders] Wierd roleover problem! AS3 basically the box is suppose to expand than contract on mouse out! - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:07 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 You override your mcName 5 times, so only the last instance remains in focus. I guess, without knowing the rest of your application, in the function addOverOut add these lines as first lines: Var mc:MovieClip = new MovieClip(); mc = mcName; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 17:46 To: Flash Coders List Subject: [Flashcoders] Wierd roleover problem! AS3 Hi Guys Im having a weird problem with a rollover, im trying to create a simple mouse_over/mouse out but for some reason the over and out do not work properly! I have 5 MC buttons on the main stage within each of the MCs is 4layers; layer 1 - a empty MC to load an image into, Layer 2 -shape tween set as a mask, Layer 3 - stop(); action and over/out labels Everything works fine upto the point when I attempt a mouse over initially it works fine but for some reason instead of stopping at the selected frame it disappears. The image loading file seams to work fine so here is my main AS file code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; public class mainClass extends MovieClip { // // Start of Class // public function mainClass():void { image1_mask.image1.file =images/image2.jpg; image2_mask.image2.file =images/image3.jpg; image3_mask.image3.file =images/image5.jpg; image4_mask.image4.file =images/image7.jpg; image5_mask.image5.file =images/image8.jpg; addOverOut(image1_mask); addOverOut(image2_mask); addOverOut(image3_mask); addOverOut(image4_mask); addOverOut(image5_mask); } public function addOverOut(mcName:MovieClip):void { mcName.addEventListener (MouseEvent.MOUSE_OVER, overHandler); mcName.addEventListener (MouseEvent.MOUSE_OUT, outHandler); mcName.addEventListener (MouseEvent.CLICK, clickHandler); mcName.mouseChildren = false; mcName.buttonMode = true; mcName.useHandCursor = true; } public function overHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(over); trace(OVER - + ev.target.name); } public function outHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(out); trace(OUT - + ev.target.name); } public function clickHandler ( ev:MouseEvent ):void { //first we need to determine which button was clicked var buttonName:String = ev.target.name; switch (buttonName) { case image1_mask: trace(Click Image 1); break; case image2_mask: trace(Click Image 2); break; case image3_mask: trace(Click Image 3); break; case image4_mask: trace(Click Image 4); break; case image5_mask: trace(Click Image 5); break; } } } } ___ 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
Re: [Flashcoders] Wierd roleover problem! AS3
http://79.170.40.163/flashdev.com/devgallery/devgallery.zip - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:33 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 It is not to say what is happing viewing the swf. If you can send me the fla and I will look at it for you. Regards Cor -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 18:26 To: Flash Coders List Subject: Re: [Flashcoders] Wierd roleover problem! AS3 Thanks for your help! Ive uploaded the SWF as i can se the problem isnt easy to explain! http://79.170.40.163/flashdev.com/devgallery/development.swf SJM - Original Message - From: Cor To: 'Flash Coders List' Sent: Sunday, July 13, 2008 5:07 PM Subject: RE: [Flashcoders] Wierd roleover problem! AS3 You override your mcName 5 times, so only the last instance remains in focus. I guess, without knowing the rest of your application, in the function addOverOut add these lines as first lines: Var mc:MovieClip = new MovieClip(); mc = mcName; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM Sent: zondag 13 juli 2008 17:46 To: Flash Coders List Subject: [Flashcoders] Wierd roleover problem! AS3 Hi Guys Im having a weird problem with a rollover, im trying to create a simple mouse_over/mouse out but for some reason the over and out do not work properly! I have 5 MC buttons on the main stage within each of the MCs is 4layers; layer 1 - a empty MC to load an image into, Layer 2 -shape tween set as a mask, Layer 3 - stop(); action and over/out labels Everything works fine upto the point when I attempt a mouse over initially it works fine but for some reason instead of stopping at the selected frame it disappears. The image loading file seams to work fine so here is my main AS file code... package { import flash.events.*; import flash.display.MovieClip; import flash.display.DisplayObject; public class mainClass extends MovieClip { // // Start of Class // public function mainClass():void { image1_mask.image1.file =images/image2.jpg; image2_mask.image2.file =images/image3.jpg; image3_mask.image3.file =images/image5.jpg; image4_mask.image4.file =images/image7.jpg; image5_mask.image5.file =images/image8.jpg; addOverOut(image1_mask); addOverOut(image2_mask); addOverOut(image3_mask); addOverOut(image4_mask); addOverOut(image5_mask); } public function addOverOut(mcName:MovieClip):void { mcName.addEventListener (MouseEvent.MOUSE_OVER, overHandler); mcName.addEventListener (MouseEvent.MOUSE_OUT, outHandler); mcName.addEventListener (MouseEvent.CLICK, clickHandler); mcName.mouseChildren = false; mcName.buttonMode = true; mcName.useHandCursor = true; } public function overHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(over); trace(OVER - + ev.target.name); } public function outHandler ( ev:MouseEvent ):void { ev.target.gotoAndPlay(out); trace(OUT - + ev.target.name); } public function clickHandler ( ev:MouseEvent ):void { //first we need to determine which button was clicked var buttonName:String = ev.target.name; switch (buttonName) { case image1_mask: trace(Click Image 1); break; case image2_mask: trace(Click Image 2); break; case image3_mask: trace(Click Image 3); break; case image4_mask: trace(Click Image 4); break; case image5_mask: trace(Click Image 5); break; } } } } ___ 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] AS3 - Displaying images from a directory
Hi Guys Is it possible to display a number of images in flash from a directory without the need for XML? SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Displaying images from a directory
Great thanks for the advice! This should work a treat! SJM - Original Message - From: Hans Wichman To: Flash Coders List Sent: Tuesday, July 08, 2008 1:21 PM Subject: Re: [Flashcoders] AS3 - Displaying images from a directory Hi, well there is only one other option I know (assuming that without xml you mean without any kind of scripting) and that is a consistent naming pattern. Eg: image1.jpg,image2.jpg,image3.jpg, etc This way you just keep loading the images until the first one that fails. HTH JC On Tue, Jul 8, 2008 at 2:02 PM, SJM - Flash [EMAIL PROTECTED] wrote: Hi Guys Is it possible to display a number of images in flash from a directory without the need for XML? SJM ___ 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] AS3 - Displaying images from a directory
My problem is the flash file is going to be embeded into a templete page to be added to a CMS unfortunatly there is no option for me to use any additional XML, PHP, ASP, Pearl script etc... the way i thought it would work is the path to the images would be a flash var! SJM - Original Message - From: Rich Shupe To: FlashCoders Sent: Tuesday, July 08, 2008 1:32 PM Subject: Re: [Flashcoders] AS3 - Displaying images from a directory Flash can't retrieve the contents from a directory on its own. You don't have to use XML, but you need something similar. PHP, for example, can provide the contents of a directory in name-value pairs or straight text if you want to avoid XML. On 7/8/08 8:02 AM, SJM - Flash wrote: Is it possible to display a number of images in flash from a directory without the need for XML? Rich http://www.LearningActionScript3.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
Re: [Flashcoders] Flash CMS
there are a few I like this one... http://www.flashden.net/item/strongflashstrong-xml-editor/7588 Some others... http://www.flashloaded.com/flashcomponents/fcms/ http://fcmspro.com/ http://flashblocks.com/ http://www.flashden.net/item/simple-website-strongcmsstrong/1074 - Original Message - From: Paul Andrews To: Flash Coders List Sent: Wednesday, July 02, 2008 9:50 AM Subject: [Flashcoders] Flash CMS I just wondered if there was a favourite CMS that was popular for use with Flash applications, or (as I suspect) do most developers just roll their own with MySQL? Paul ___ 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] Really need your help guys! AS3
Hi Guys as you know im fairly new to AS3 and im having a massive problem with some code ive been writing, unfortunately there is loads of it so ive had to create a couple of examples of what i want, as i can get them to work separately but not together! 1 - Click the link - http://flashdev.dnsalias.org:8080/example1/default.asp 2 - Then click on the 'Jungle' styled image 3 - Move your mouse (Text gets selected) 4 - Click on the 'Photo Tools' tab 5 - Click the 'upload photo' button 6 - Select a 15-20k image (This is a fake upload so dont worry what it is), hit OK Now here is where it goes wrong 7 - choose to edit the photo (i.e. size, position rotation etc...) What should happen now is when you edit the photo it should action it on the small image (if you increse the size, the image should change), however it for some reason re-focuses the text box. (To retry the script please start from section 1 and refresh/clear cache) To see a working version of sections 4-7 click here... Click the link - http://flashdev.dnsalias.org:8080/example2/default.asp then work through sections 1-7 --- The problem... Soon as a textbox is clicked in or focused on for some reason this is kept in memory. What i want to happen... When the flash application loads i want the text box to be selected and ready to type in, when you then upload an image you are already able to edit the image without having to click the image So my question to you guys... Is it possible to stop the textbox being re-focused? as stage.focus = null; does not seam to work in this instance! Thanks in advance SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Focus problem
Yes sorry the links only work when my machine is on, i will leave on over noight for you guys to take a look! Many thanks! SJM - Original Message - From: Cor To: 'Flash Coders List' Sent: Friday, June 20, 2008 7:43 PM Subject: RE: [Flashcoders] Focus problem Link are not working here Cor The Netherlands -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of SJM - Flash Sent: vrijdag 20 juni 2008 15:17 To: Flash Coders List Subject: Fw: [Flashcoders] Focus problem Guys? Anyone? Hi Guys as you know im fairly new to AS3 and im having a massive problem with some code ive been writing, unfortunately there is loads of it so ive had to create a couple of examples of what i want, as i can get them to work separately but not together! 1 - Click the link - http://flashdev.dnsalias.org:8080/example1/default.asp 2 - Then click on the 'Jungle' styled image 3 - Move your mouse (Text gets selected) 4 - Click on the 'Photo Tools' tab 5 - Click the 'upload photo' button 6 - Select a 15-20k image (This is a fake upload so dont worry what it is), hit OK Now here is where it goes wrong 7 - choose to edit the photo (i.e. size, position rotation etc...) What should happen now is when you edit the photo it should action it on the small image (if you increse the size, the image should change), however it for some reason re-focuses the text box. (To retry the script please start from section 1 and refresh/clear cache) To see a working version of sections 4-7 click here... Click the link - http://flashdev.dnsalias.org:8080/example2/default.asp then work through sections 1-7 --- The problem... Soon as a textbox is clicked in or focused on for some reason this is kept in memory. What i want to happen... When the flash application loads i want the text box to be selected and ready to type in, when you then upload an image you are already able to edit the image without having to click the image So my question to you guys... Is it possible to stop the textbox being re-focused? as stage.focus = null; does not seam to work in this instance! Thanks in advance SJM ___ 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
Fw: [Flashcoders] Focus problem
Guys? Anyone? Hi Guys as you know im fairly new to AS3 and im having a massive problem with some code ive been writing, unfortunately there is loads of it so ive had to create a couple of examples of what i want, as i can get them to work separately but not together! 1 - Click the link - http://flashdev.dnsalias.org:8080/example1/default.asp 2 - Then click on the 'Jungle' styled image 3 - Move your mouse (Text gets selected) 4 - Click on the 'Photo Tools' tab 5 - Click the 'upload photo' button 6 - Select a 15-20k image (This is a fake upload so dont worry what it is), hit OK Now here is where it goes wrong 7 - choose to edit the photo (i.e. size, position rotation etc...) What should happen now is when you edit the photo it should action it on the small image (if you increse the size, the image should change), however it for some reason re-focuses the text box. (To retry the script please start from section 1 and refresh/clear cache) To see a working version of sections 4-7 click here... Click the link - http://flashdev.dnsalias.org:8080/example2/default.asp then work through sections 1-7 --- The problem... Soon as a textbox is clicked in or focused on for some reason this is kept in memory. What i want to happen... When the flash application loads i want the text box to be selected and ready to type in, when you then upload an image you are already able to edit the image without having to click the image So my question to you guys... Is it possible to stop the textbox being re-focused? as stage.focus = null; does not seam to work in this instance! Thanks in advance SJM ___ 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] Focus problem
Hi Guys as you know im fairly new to AS3 and im having a massive problem with some code ive been writing, unfortunately there is loads of it so ive had to create a couple of examples of what i want, as i can get them to work separately but not together! 1 - Click the link - http://flashdev.dnsalias.org:8080/example1/default.asp 2 - Then click on the 'Jungle' styled image 3 - Move your mouse (Text gets selected) 4 - Click on the 'Photo Tools' tab 5 - Click the 'upload photo' button 6 - Select a 15-20k image (This is a fake upload so dont worry what it is), hit OK Now here is where it goes wrong 7 - choose to edit the photo (i.e. size, position rotation etc...) What should happen now is when you edit the photo it should action it on the small image (if you increse the size, the image should change), however it for some reason re-focuses the text box. (To retry the script please start from section 1 and refresh/clear cache) To see a working version of sections 4-7 click here... Click the link - http://flashdev.dnsalias.org:8080/example2/default.asp then work through sections 1-7 --- The problem... Soon as a textbox is clicked in or focused on for some reason this is kept in memory. What i want to happen... When the flash application loads i want the text box to be selected and ready to type in, when you then upload an image you are already able to edit the image without having to click the image So my question to you guys... Is it possible to stop the textbox being re-focused? as stage.focus = null; does not seam to work in this instance! Thanks in advance SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Conversion SWF - PDF/EPS
We have been working on a similar type of projects, there are a few options! The best one i found was www.alivepdf.org but if its not what your looking for (as it wasnt for us) try looking for a PHP / ASP version. In the end due to server technology we used ABCPDF its an asp/.net pdf creator and works great for what we need! Cheers SJM - Original Message - From: [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Thursday, June 12, 2008 10:13 AM Subject: [Flashcoders] Conversion SWF - PDF/EPS Hello everybody, I'm looking for a any solution (really anything) to convert SWF files to another vector format used in print (EPS or PDF) or even generate this format on the fly using AS3/PHP/whatever... Here is a summary of the problem : I have an application in which the user can add text or pre-defined shapes (MovieClips) and then scale, rotate, move them... As a final step I need to generate a vector file (PDF or EPS) to be sent to the print factory. The pre-defined shapes are provided to me as vector PDF files, so I imported them in the Flash IDE then re-export them as SWF in order to be dynamically loaded in the app. I already take a look at AlivePDF, but he can't generate vector PDF from a DisplayObject... I'm also thinking that I can generate a XML file describing the transformations applied to the shapes to later post-process everything with originals PDF but I can't even find a solution in this way. And it doesn't solve my problem in the case the user added text with a specific font and then distord it to fit his needs. So, if someone has a clue or a trick (even if it needs a manual intervention) to get me out of this mess, it would be great. Thanks, Florent JEAN French Flash Developer http://www.nowhen.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] AS3 - A simple questions
Hi Guys a simple questions for you Basically I want to produce similar code that creates 3 TextFields and when clicked (or focused) they need to say Hi I'm TextField [num], I would like to avoid putting the TextFields in MovieClips if possible. // // Creates 3 new MovieClips and adds a custom property itm // for (var i:Number = 0; i 3; i++) { var mc:MovieClip = new MovieClip(); mc.graphics.beginFill(0xFF); mc.graphics.drawRect(0, 0, 100, 80); mc.graphics.endFill(); mc.x = 80*i; mc.y = 60*i; mc.itm = i; addChild(mc); mc.addEventListener(MouseEvent.CLICK, itemClicked); } // // Called when clicked, traces the custom property // function itemClicked(ev:Event):void { trace(Hi I'm MovieClip + int(ev.target.itm + 1)); } Thanks SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Cross domain AS3
Hi Guys My question; Is it possible in an XML file, to have an absolute link to an image ie. /banner/flash/uploadedimage/45/sunset.jpg. I need the url to be capable of being absolute and to contain the domain e.g. http://www.mydomain.co.uk/banner/flash/uploadedimage/45/sunset.jpg I currently have it set up but the image does not show. It only shows if the url is relative ie. uploadedimage/45/sunset.jpg SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 - Dynamic Variable?
Another one for you... I am having some trouble with dynamic variables, basically I expect this['xmlClass.xmlData.RecImageW' + 1] to mean xmlClass.xmlData.RecImageW1, but it seems it does not? // VALUES xmlClass.xmlData.RecImageW1 = 120; xmlClass.xmlData.RecImageW2 = 1220; xmlClass.xmlData.RecImageW3 = 3; xmlClass.xmlData.RecImageW4 = 23; xmlClass.xmlData.RecImageW5 = 222; for (var i = 1; i = 5; i++) { trace( this['xmlClass.xmlData.RecImageW' + i] ); } // OUTPUT SHOULD BE 120 1220 3 23 222 xmlData is type XML in the class xmlClass, it is set as public and tracing xmlClass.xmlData.RecImageW1 works so I know I can access the value, I just need a method that will loop through all of the variables and trace them. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 - Upload image problem
Hi guys im having problems with uploading an image, i cant seam to get it to work! Most of the code is from the help files but still no joy! Any ideas... public function uploadImage( ev:MouseEvent ):void { uploadURL = new URLRequest(); uploadURL.url = _mainClass._imgUploadURL; file = new FileReference(); file.browse(getTypes()); trace(uploadImage: + ev); } The above trace outouts this... uploadImage: [MouseEvent type=click bubbles=true cancelable=false eventPhase=3 localX=16 localY=4 stageX=95.65 stageY=236.72 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]] As far as i can tell it does not go any further into the code below! private function getTypes():Array { var allTypes:Array = new Array(getImageTypeFilter()); return allTypes; } private function getImageTypeFilter():FileFilter { return new FileFilter(Images (*.jpg, *.jpeg), *.jpg;*.jpeg;); } private function cancelHandler(ev:Event):void { trace(cancelHandler: + ev); } private function completeHandler(ev:Event):void { trace(completeHandler: + ev); } private function uploadCompleteDataHandler(ev:Event):void { trace(uploadCompleteData: + ev); _xmlClass.xmlLoader(bannerInfo.xml); _xmlClass.addEventListener(Event.COMPLETE, _mainClass.afterUploadXML); } private function httpStatusHandler(ev:HTTPStatusEvent):void { trace(httpStatusHandler: + ev); } private function ioErrorHandler(ev:IOErrorEvent):void { trace(ioErrorHandler: + ev); } private function openHandler(ev:Event):void { trace(openHandler: + ev); } private function progressHandler(ev:ProgressEvent):void { var file:FileReference = FileReference(ev.target); trace(progressHandler name= + file.name + bytesLoaded= + ev.bytesLoaded + bytesTotal= + ev.bytesTotal); } private function selectHandler(event:Event):void { var file:FileReference = FileReference(event.target); trace(selectHandler: name= + file.name + URL= + uploadURL.url); file.upload(uploadURL); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Upload image problem
Glen is that not for AS2? - Original Message - From: Glen Pike To: Flash Coders List Sent: Tuesday, May 20, 2008 12:30 PM Subject: Re: [Flashcoders] AS3 - Upload image problem http://www.tink.ws/blog/a-round-trip-with-filereference/ SJM - Flash wrote: Hi guys im having problems with uploading an image, i cant seam to get it to work! Most of the code is from the help files but still no joy! Any ideas... public function uploadImage( ev:MouseEvent ):void { uploadURL = new URLRequest(); uploadURL.url = _mainClass._imgUploadURL; file = new FileReference(); file.browse(getTypes()); trace(uploadImage: + ev); } The above trace outouts this... uploadImage: [MouseEvent type=click bubbles=true cancelable=false eventPhase=3 localX=16 localY=4 stageX=95.65 stageY=236.72 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]] As far as i can tell it does not go any further into the code below! private function getTypes():Array { var allTypes:Array = new Array(getImageTypeFilter()); return allTypes; } private function getImageTypeFilter():FileFilter { return new FileFilter(Images (*.jpg, *.jpeg), *.jpg;*.jpeg;); } private function cancelHandler(ev:Event):void { trace(cancelHandler: + ev); } private function completeHandler(ev:Event):void { trace(completeHandler: + ev); } private function uploadCompleteDataHandler(ev:Event):void { trace(uploadCompleteData: + ev); _xmlClass.xmlLoader(bannerInfo.xml); _xmlClass.addEventListener(Event.COMPLETE, _mainClass.afterUploadXML); } private function httpStatusHandler(ev:HTTPStatusEvent):void { trace(httpStatusHandler: + ev); } private function ioErrorHandler(ev:IOErrorEvent):void { trace(ioErrorHandler: + ev); } private function openHandler(ev:Event):void { trace(openHandler: + ev); } private function progressHandler(ev:ProgressEvent):void { var file:FileReference = FileReference(ev.target); trace(progressHandler name= + file.name + bytesLoaded= + ev.bytesLoaded + bytesTotal= + ev.bytesTotal); } private function selectHandler(event:Event):void { var file:FileReference = FileReference(event.target); trace(selectHandler: name= + file.name + URL= + uploadURL.url); file.upload(uploadURL); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] AS3 - Upload image problem
Thanks Glen ive added listener and seams to be ok! Need to test a live version now tho! - Original Message - From: Glen Pike To: Flash Coders List Sent: Tuesday, May 20, 2008 12:53 PM Subject: Re: [Flashcoders] AS3 - Upload image problem Apologies, it is. You need to add listeners for all the events that FileReference dispatches. At a minimum you need to listen for the select event to begin uploading: file.addEventListener(Event.SELECT, selectHandler); Here is a link to the Flex 2 langref with an example that adds all the listeners - check the Flash one if you are using CS3, but the class should be the same, so you may be okay. http://livedocs.adobe.com/flex/201/langref/flash/net/FileReference.html#includeExamplesSummary HTH Glen SJM - Flash wrote: Glen is that not for AS2? - Original Message - From: Glen Pike To: Flash Coders List Sent: Tuesday, May 20, 2008 12:30 PM Subject: Re: [Flashcoders] AS3 - Upload image problem http://www.tink.ws/blog/a-round-trip-with-filereference/ SJM - Flash wrote: Hi guys im having problems with uploading an image, i cant seam to get it to work! Most of the code is from the help files but still no joy! Any ideas... public function uploadImage( ev:MouseEvent ):void { uploadURL = new URLRequest(); uploadURL.url = _mainClass._imgUploadURL; file = new FileReference(); file.browse(getTypes()); trace(uploadImage: + ev); } The above trace outouts this... uploadImage: [MouseEvent type=click bubbles=true cancelable=false eventPhase=3 localX=16 localY=4 stageX=95.65 stageY=236.72 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]] As far as i can tell it does not go any further into the code below! private function getTypes():Array { var allTypes:Array = new Array(getImageTypeFilter()); return allTypes; } private function getImageTypeFilter():FileFilter { return new FileFilter(Images (*.jpg, *.jpeg), *.jpg;*.jpeg;); } private function cancelHandler(ev:Event):void { trace(cancelHandler: + ev); } private function completeHandler(ev:Event):void { trace(completeHandler: + ev); } private function uploadCompleteDataHandler(ev:Event):void { trace(uploadCompleteData: + ev); _xmlClass.xmlLoader(bannerInfo.xml); _xmlClass.addEventListener(Event.COMPLETE, _mainClass.afterUploadXML); } private function httpStatusHandler(ev:HTTPStatusEvent):void { trace(httpStatusHandler: + ev); } private function ioErrorHandler(ev:IOErrorEvent):void { trace(ioErrorHandler: + ev); } private function openHandler(ev:Event):void { trace(openHandler: + ev); } private function progressHandler(ev:ProgressEvent):void { var file:FileReference = FileReference(ev.target); trace(progressHandler name= + file.name + bytesLoaded= + ev.bytesLoaded + bytesTotal= + ev.bytesTotal); } private function selectHandler(event:Event):void { var file:FileReference = FileReference(event.target); trace(selectHandler: name= + file.name + URL= + uploadURL.url); file.upload(uploadURL); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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 -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] AS3 - Upload image problem
Cheers Jimbo, i downloaded this file to see what i was missing from mine, added the listenor Glen was taling about and alls well! :o) - Original Message - From: Jimbo To: flashcoders@chattyfig.figleaf.com Sent: Tuesday, May 20, 2008 1:02 PM Subject: Re: [Flashcoders] AS3 - Upload image problem Here's one if you don't want to roll your own- it's really easy to customize: http://www.flepstudio.org/english/utilities/free-utilities/flash-cs3-uploader-_-free-utility-2007073189.html jimbo *** REPLY SEPARATOR *** On 5/20/2008 at 12:44 PM SJM - Flash wrote: Glen is that not for AS2? - Original Message - From: Glen Pike To: Flash Coders List Sent: Tuesday, May 20, 2008 12:30 PM Subject: Re: [Flashcoders] AS3 - Upload image problem http://www.tink.ws/blog/a-round-trip-with-filereference/ SJM - Flash wrote: Hi guys im having problems with uploading an image, i cant seam to get it to work! Most of the code is from the help files but still no joy! Any ideas... public function uploadImage( ev:MouseEvent ):void { uploadURL = new URLRequest(); uploadURL.url = _mainClass._imgUploadURL; file = new FileReference(); file.browse(getTypes()); trace(uploadImage: + ev); } The above trace outouts this... uploadImage: [MouseEvent type=click bubbles=true cancelable=false eventPhase=3 localX=16 localY=4 stageX=95.65 stageY=236.72 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0]] As far as i can tell it does not go any further into the code below! private function getTypes():Array { var allTypes:Array = new Array(getImageTypeFilter()); return allTypes; } private function getImageTypeFilter():FileFilter { return new FileFilter(Images (*.jpg, *.jpeg), *.jpg;*.jpeg;); } private function cancelHandler(ev:Event):void { trace(cancelHandler: + ev); } private function completeHandler(ev:Event):void { trace(completeHandler: + ev); } private function uploadCompleteDataHandler(ev:Event):void { trace(uploadCompleteData: + ev); _xmlClass.xmlLoader(bannerInfo.xml); _xmlClass.addEventListener(Event.COMPLETE, _mainClass.afterUploadXML); } private function httpStatusHandler(ev:HTTPStatusEvent):void { trace(httpStatusHandler: + ev); } private function ioErrorHandler(ev:IOErrorEvent):void { trace(ioErrorHandler: + ev); } private function openHandler(ev:Event):void { trace(openHandler: + ev); } private function progressHandler(ev:ProgressEvent):void { var file:FileReference = FileReference(ev.target); trace(progressHandler name= + file.name + bytesLoaded= + ev.bytesLoaded + bytesTotal= + ev.bytesTotal); } private function selectHandler(event:Event):void { var file:FileReference = FileReference(event.target); trace(selectHandler: name= + file.name + URL= + uploadURL.url); file.upload(uploadURL); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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 d ___ 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] Why do you compile with the Flash IDE?
The reason i am yet to move to Flex is because as it stands i don't have the time to start learning/using a new prog! Ive been using flash since version 4 so know the program quite well! Once ive had time to play with Flex i may well swap to using it! SJM - Original Message - From: EECOLOR To: Flash Coders List Sent: Friday, May 16, 2008 12:50 PM Subject: [Flashcoders] Why do you compile with the Flash IDE? I hardly ever use the Flash IDE these days. I program with FlexBuilder and import images created by the designers. I am wondering, why are some of you still using the Flash IDE to compile your applications? What is the big benefit of using the Flash IDE in combination with ActionScript? Greetz Erik ___ 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] AS3 - Embeding Fonts
Hi Guys i know about embeding fonts using the 'embed' button in the textfields property inspector within in the ide. Can anyone point me to some definitive solutions for embeding fonts into flash using actionscript (v3),! Thanks SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Info mailing list
Try www.osflash.org SJM - Original Message - From: Romuald Quantin To: Flashcoders@chattyfig.figleaf.com Sent: Thursday, May 15, 2008 4:15 PM Subject: [Flashcoders] Info mailing list Hi again, still me. I'm following a lot of blogs and specific mailing list like Papervision, or whatever. This mailing list is great but could you share with me some nice general actionscript mailing list you might know? I googled it but I didn't really find others. Thanks. Romu ___ 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] AS3 - Embeding Fonts
Ive read a load of sites that reference that way of doing it, however id does not seam to work in AS3. Further down the page the guy who writes the blog it is says this... Tink Says: January 2nd, 2007 at 1:39 am Flash doesn't understand any meta tags. There is no need to use this method in Flash as you can embed the font in the IDE. Granted it would be nice if Flash did understand the embed tag though. Gianluca Says: January 6th, 2007 at 11:21 pm So how to embed font in Flash as3? Tink Says: January 7th, 2007 at 4:52 pm Same as AS 2.0. Either have the font in your library or create a TextField on the stage and embed the characters you want. Is this correct? is the only way to embed the font in the IDE?? SJM - Original Message - From: EECOLOR To: Flash Coders List Sent: Thursday, May 15, 2008 8:19 PM Subject: Re: [Flashcoders] AS3 - Embeding Fonts Second link on google: http://www.tink.ws/blog/embedding-fonts-in-as3/ Greetz Erik On 5/15/08, SJM - Flash [EMAIL PROTECTED] wrote: Hi Guys i know about embeding fonts using the 'embed' button in the textfields property inspector within in the ide. Can anyone point me to some definitive solutions for embeding fonts into flash using actionscript (v3),! Thanks SJM ___ 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] [AS3] Problem with For loop
This function should loop through 5 times creating 5 different MovieClips, each one with a mouse click event attached, which should trace the value of i either 1, 2, 3, 4 or 5. So the first movieclip should output 1, second should output 2 and so on... for (var i = 0; i itemList.length(); i++) // itemList.length() is equal to 5 { _summaryElement[i] = loadLibrary(itemContainer); // Loads MovieClip from library trace(i); // Outputs correctly 1... 2... 3... 4... 5... var summaryClick = function (ev:Event) { trace(i); // Outputs incorrectly (Outputs 5 on each MovieClip click) ??? } addChild(_summaryElement[i]); // Adds MovieClip to stage _summaryElement[i].addEventListener(MouseEvent.CLICK, summaryClick); // Adds an click event to each MovieClip } Thanks SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Problem with For loop
Yay that works great i have a slight other problem tho with the same script... This code should load a MovieClip from the library 5 times, place each on the stage and then load a different image into each one, instead it loads the 5 MovieClips from the library, places them on the stage and then only loads the image into the last (5th) MovieClip this code will not run as its stripped var itemList:XMLList = locationInfo.item; for (var i = 0; i itemList.length(); i++) // Loops through 5 times { _summaryElement[i] = loadLibrary(summaryContainer); // Load our MovieClip from the library loadImage(images/ + i + .jpg, _summaryElement[i].sumImg); // Should load image into _summaryElement[i].sumImg which is a blank placeholder movieclip } function loadImage(filename:String, mcName:MovieClip):void { _mcName = mcName; // Contains MovieClip object (object 1 through 5) var imageLoader:Loader = new Loader(); var imageURL:URLRequest = new URLRequest(filename); imageLoader.load (imageURL); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoadComplete); } function imgLoadComplete(ev:Event):void { _mcName.addChild(ev.target.content); // This should add the loaded image into the placeholder movieclip for each of the 5 MovieClips } SJM - Original Message - From: Rob Romanek To: Flash Coders List Sent: Friday, May 02, 2008 4:23 PM Subject: Re: [Flashcoders] [AS3] Problem with For loop Try the change I've added below and see if it works for you. On 2-May-08, at 10:58 AM, SJM - Flash wrote: This function should loop through 5 times creating 5 different MovieClips, each one with a mouse click event attached, which should trace the value of i either 1, 2, 3, 4 or 5. So the first movieclip should output 1, second should output 2 and so on... for (var i = 0; i itemList.length(); i++) // itemList.length() is equal to 5 { _summaryElement[i] = loadLibrary(itemContainer); // Loads MovieClip from library _summaryElement[i].name = String(i); trace(i); // Outputs correctly 1... 2... 3... 4... 5... var summaryClick = function (ev:Event) { //trace(i); // Outputs incorrectly (Outputs 5 on each MovieClip click) ??? trace(ev.target.name); } addChild(_summaryElement[i]); // Adds MovieClip to stage _summaryElement[i].addEventListener(MouseEvent.CLICK, summaryClick); // Adds an click event to each MovieClip } Thanks SJM ___ 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] Random incriments [AS3]
Hi Guys Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H W' question). Im trying to set the values for the actual image so when its rotated i still have the correct height and width to output (as the box width/height will now be bigger than the image height/width). The height and width are both set from the same XML source; W: 100 H: 80 // START OF FLOW Push the increase button, here is the code from the button selectedImage.width *= 1.1; selectedImage.height *= 1.1; imgWidthVar *= 1.1; imgHeightVar *= 1.1; The image and bounding MC change in size, here is the Trace info of the values (please note there has been no rotation)... IMGAGE W: 110 H: 88 BOX W: 110 H: 88 IMGAGE W: 121 H: 96 BOX W: 121 H: 96.81 IMGAGE W: 133 H: 105 BOX W: 133.1 H: 106.5 IMGAGE W: 146 H: 115 BOX W: 146.4 H: 117.15 // END OF FLOW Whats going wrong? Both image and box H/W should be identical Thanks in advance SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Random incriments [AS3]
Hi Glen thanks for your reply, this is a continuation really from what you told me about Pythagoras to do this i need the actual image height and width. Normally i would do it this way but when the selected image is rotated selectedImage will be wider than imageWidth and will not output the correct information. SJM - Original Message - From: Glen Pike To: Flash Coders List Sent: Thursday, May 01, 2008 1:53 PM Subject: Re: [Flashcoders] Random incriments [AS3] Hi, This is possibly due to rounding errors. If you want the components to remain the same size, you should set the size of one using the size of the other... selectedImage.width *= 1.1; imgWidthVar = selectedImage.width; etc. Glen SJM - Flash wrote: Hi Guys Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H W' question). Im trying to set the values for the actual image so when its rotated i still have the correct height and width to output (as the box width/height will now be bigger than the image height/width). The height and width are both set from the same XML source; W: 100 H: 80 // START OF FLOW Push the increase button, here is the code from the button selectedImage.width *= 1.1; selectedImage.height *= 1.1; imgWidthVar *= 1.1; imgHeightVar *= 1.1; The image and bounding MC change in size, here is the Trace info of the values (please note there has been no rotation)... IMGAGE W: 110 H: 88 BOX W: 110 H: 88 IMGAGE W: 121 H: 96 BOX W: 121 H: 96.81 IMGAGE W: 133 H: 105 BOX W: 133.1 H: 106.5 IMGAGE W: 146 H: 115 BOX W: 146.4 H: 117.15 // END OF FLOW Whats going wrong? Both image and box H/W should be identical Thanks in advance SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] Random incriments [AS3]
Glen, no i do not want to shrink the image i just want to maintain the original valuesthen calculate the increas/decreas info (ie original W 100, H 80 + [1 click] = W 110, H 90) so i can use Pythagoras in asp to do its job as you mentioned!! ... I am guessing you are trying to store your original unrotated width and height of the image for later?... Yes i am, I am also tring to multiply the value at the sametime so i can output W2 H2 ... From your diagram - I think you have X2 and X on the wrong axis - but using your variables and assuming 0, 0 is at the bottom left hand corner... 0,0 is the XY point (top right of actual photo), X2 does not exist and i can not get the information, if i could then it would be great! Thanks agin for your help! SJM - Original Message - From: Glen Pike To: Flash Coders List Sent: Thursday, May 01, 2008 3:02 PM Subject: Re: [Flashcoders] Random incriments [AS3] Hi, I am a bit confused as to what you want to do... If you rotate the image, I think it will return the width and height of it's bounding box, but I think you are saying you want to shrink the bounding box so it matches your original size??? - If you do this, you will shrink the image too. I am guessing you are trying to store your original unrotated width and height of the image for later? But you can calculate your actual image size from the bounding box values you have too... From your diagram - I think you have X2 and X on the wrong axis - but using your variables and assuming 0, 0 is at the bottom left hand corner (it may not be in the Flash Player): w2 = Math.sqrt( (WIDTH - Y) * (WIDTH - Y) + (X2 * X2)); h2 = Math.sqrt(Y * Y + (HEIGHT - X2) * (HEIGHT - X2)); Look at Proof #4 on this page if you want to see what I mean. http://www.cut-the-knot.org/pythagoras/index.shtml HTH Glen SJM - Flash wrote: Hi Glen thanks for your reply, this is a continuation really from what you told me about Pythagoras to do this i need the actual image height and width. Normally i would do it this way but when the selected image is rotated selectedImage will be wider than imageWidth and will not output the correct information. SJM - Original Message - From: Glen Pike To: Flash Coders List Sent: Thursday, May 01, 2008 1:53 PM Subject: Re: [Flashcoders] Random incriments [AS3] Hi, This is possibly due to rounding errors. If you want the components to remain the same size, you should set the size of one using the size of the other... selectedImage.width *= 1.1; imgWidthVar = selectedImage.width; etc. Glen SJM - Flash wrote: Hi Guys Im writing an application where you can manipulate images increse/decrease size rotate flip etc... but i need to keep the actual image size in memory for outputing (following on to my 'Reading position info X, Y, H W' question). Im trying to set the values for the actual image so when its rotated i still have the correct height and width to output (as the box width/height will now be bigger than the image height/width). The height and width are both set from the same XML source; W: 100 H: 80 // START OF FLOW Push the increase button, here is the code from the button selectedImage.width *= 1.1; selectedImage.height *= 1.1; imgWidthVar *= 1.1; imgHeightVar *= 1.1; The image and bounding MC change in size, here is the Trace info of the values (please note there has been no rotation)... IMGAGE W: 110 H: 88 BOX W: 110 H: 88 IMGAGE W: 121 H: 96 BOX W: 121 H: 96.81 IMGAGE W: 133 H: 105 BOX W: 133.1 H: 106.5 IMGAGE W: 146 H: 115 BOX W: 146.4 H: 117.15 // END OF FLOW Whats going wrong? Both image and box H/W should be identical Thanks in advance SJM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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 -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk
[Flashcoders] (AS3) Object to an Array
Hi Guys Im in need of finding out how or even if its possible to convert an object to an array? Basically I am trying to output some vars from flash to an PHP script, yet when PHP recieves the $_POST['textVars'] as [object Object] which is a string and not an array so I can't access it with $_POST['textVars'][0]['x'], which should output the value of textBox1.x. var textVars:Object = new Object; textVars[0] = { x :textBox1.x, y :textBox1.y, width :textBox1.width, height :textBox1.height, rotation :textBox1.rotation }; textVars[1] = { x :textBox2.x, y :textBox2.y, width :textBox2.width, height :textBox2.height, rotation :textBox2.rotation }; sendVars.textVars = textVars; sendRequest.data = setVars; sendRequest.url = process.php; sendRequest.method = URLRequestMethod.POST; sendToURL(sendRequest); Thanks SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] (AS3) Object to an Array
Hey Glen thanks for your speedy response its much appriciated! Ive tried the code you provided but am still getting the same output. var textVars = new Array(); textVars[0] = { a :0, b :1, c :2 }; textVars[1] = { d :3, e :4, f :5 }; var numVars:int = textVars.length; for(var i:int = 0;i numVars;i++) { var obj:Object = textVars[i]; for (var itm:String in obj) { trace(itm + = + obj[itm]); textVars[i][itm] = obj[itm]; } } var sendRequest:URLRequest = new URLRequest(process.php); var setVars:URLVariables = new URLVariables(); setVars.textVars = textVars; sendRequest.data = setVars; sendRequest.method = URLRequestMethod.POST; sendToURL(sendRequest); Basically we are trying to output a $_POST array that is formated similar to below... Array ( [textVars] = Array ( [0] = Array ( [a] = 0 [b] = 1 [c] = 2 ) [1] = Array ( [d] = 3 [e] = 4 [f] = 5 ) ) ) instead we are getting: Array ( [textVars] = [object Object] ) Thanks SM - Original Message - From: Glen Pike To: Flash Coders List Sent: Tuesday, April 29, 2008 1:43 PM Subject: Re: [Flashcoders] (AS3) Object to an Array Hi, You could create a loop to look through each object and then make up your arrays a bit like this - untested: sendVars.textVars = new Array(); var numVars:int = textVars.length; for(var i:int = 0;i numVars;i++) { var obj:Object = textVars[i]; for(item:String in obj) { trace(itm + = + obj[itm]); sendVars.textVars[i][itm] = obj[itm]; } } //then send your data... SWXFormat handles this sort of thing quite nicely, but they were still working on AS3 when I last looked. HTH Glen SJM - Flash wrote: Hi Guys Im in need of finding out how or even if its possible to convert an object to an array? Basically I am trying to output some vars from flash to an PHP script, yet when PHP recieves the $_POST['textVars'] as [object Object] which is a string and not an array so I can't access it with $_POST['textVars'][0]['x'], which should output the value of textBox1.x. var textVars:Object = new Object; textVars[0] = { x :textBox1.x, y :textBox1.y, width :textBox1.width, height :textBox1.height, rotation :textBox1.rotation }; textVars[1] = { x :textBox2.x, y :textBox2.y, width :textBox2.width, height :textBox2.height, rotation :textBox2.rotation }; sendVars.textVars = textVars; sendRequest.data = setVars; sendRequest.url = process.php; sendRequest.method = URLRequestMethod.POST; sendToURL(sendRequest); Thanks SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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] (AS3) Object to an Array
Unfortunalty we are only testing in PHP, the application is going to be on an ASP coded website so we really need to fix this from flash! :o( - Original Message - From: Muzak To: Flash Coders List Sent: Tuesday, April 29, 2008 2:09 PM Subject: Re: [Flashcoders] (AS3) Object to an Array use remoting: http://www.amfphp.org/ - Original Message - From: SJM - Flash [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tuesday, April 29, 2008 2:19 PM Subject: [Flashcoders] (AS3) Object to an Array Hi Guys Im in need of finding out how or even if its possible to convert an object to an array? Basically I am trying to output some vars from flash to an PHP script, yet when PHP recieves the $_POST['textVars'] as [object Object] which is a string and not an array so I can't access it with $_POST['textVars'][0]['x'], which should output the value of textBox1.x. var textVars:Object = new Object; textVars[0] = { x :textBox1.x, y :textBox1.y, width :textBox1.width, height :textBox1.height, rotation :textBox1.rotation }; textVars[1] = { x :textBox2.x, y :textBox2.y, width :textBox2.width, height :textBox2.height, rotation :textBox2.rotation }; sendVars.textVars = textVars; sendRequest.data = setVars; sendRequest.url = process.php; sendRequest.method = URLRequestMethod.POST; sendToURL(sendRequest); Thanks SM ___ 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] (AS3) Object to an Array
Thanks for your help guys i went down the JSON route and won! :o) - Original Message - From: Muzak To: Flash Coders List Sent: Tuesday, April 29, 2008 3:35 PM Subject: Re: [Flashcoders] (AS3) Object to an Array ASP .NET ? use remoting ;-) http://www.themidnightcoders.com/weborb/dotnet/ - Original Message - From: SJM - Flash [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Tuesday, April 29, 2008 3:52 PM Subject: Re: [Flashcoders] (AS3) Object to an Array Unfortunalty we are only testing in PHP, the application is going to be on an ASP coded website so we really need to fix this from flash! :o( - Original Message - From: Muzak To: Flash Coders List Sent: Tuesday, April 29, 2008 2:09 PM Subject: Re: [Flashcoders] (AS3) Object to an Array use remoting: http://www.amfphp.org/ ___ 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] { AS3 } Reading position info X, Y, H W
Yeah i know what the rotastion is, but am not sure what to do with regards to pythagoras and working out the hypotenuse. Can you point me to any examples of how to use validateNow() as ive looked through Flash Help/Livedocs and cant seam to figure out how its used! SM - Original Message - From: Glen Pike To: Flash Coders List Sent: Monday, April 28, 2008 2:55 PM Subject: Re: [Flashcoders] { AS3 } Reading position info X, Y, H W Do you know the rotation? 2 ways to do this: Either rotate the image back to 0 if it can be done - if you do this you will need to call validateNow() on the instance after changing values, read the new w2, etc. then rotate it back... Or do some pythagoras w2 is the hypotenuse of one triangle. h2 is the hyp of another... You can work the rest out :) Glen [EMAIL PROTECTED] wrote: Hi i need some help reading position info X, Y, H W of a desired object. Now i know some of you are going to jump streight in with answeres like... instanceName.y, instanceName.x etc... but i would like you to take a look at the following link first, you will see a number of lines drawn to explanin the valuse i am after! http://79.170.40.163/flashdev.com/ I already have X, Y bounding box H/W values. I need to read W2, H2 X2 if possible? Regards SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ 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