Re: [Flashcoders] as3 classes var query
You'd need to instantiate the other class and then access it, like this: package test { public class test2 extends Sprite { public function test2(){ var testInstance:test = new test(); trace(testInstance.hello); } } } Also, it's good practice to capitalise your class names: Test, Test2 rather than test, test2. Piers On 12 Jun 2008, at 13:33, Johnny Zen wrote: Hi all I am currently learning AS3, and I seem to be a bit confused on understanding accessing variables outside of the class it resides in. for example: package test { public class test extends Sprite { public var hello = hello; } } I thought this var will be available to access from within another class like this: package test { public class test2 extends Sprite { hello = hello from another class; } } --- But I get : 1120: Access of undefined property hello. Is anyone kind enough to put me right ? Thanks Johnny ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders [EMAIL PROTECTED] 0207 631 3278 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: How can I target an object fromadot-sytaxstring?
Hey Victor I like your solution thanks :) Romu, I'll check out your method when I get a little time, I have to get this working quickly so the dirty method will do for now. Thanks everyone! Ali On 12 Jun 2008, at 11:29, Romuald Quantin wrote: If you fell developing it, I wrote an experiment about the flash proxy class. I would do it that way. The proxy class makes you able to handle new methods and properties on any other classes (especially the one that are not dynamic, almost all of them), to access to something like: mySprite.myNewProperty mySprite.myNewMethod In my example I proxy an array but you could do it for anything. http://www.soundstep.com/blog/2008/05/27/data-access-with-array- extending-an d-proxy-extending/ Make a search on Google with the keywords as3, proxy and dot syntax maybe someone has already done that. Hope it helps. Romu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Viktor Hesselbom Sent: 12 June 2008 10:01 To: Flash Coders List Subject: Re: [Flashcoders] AS3: How can I target an object from adot-sytaxstring? One dirty way would be like this: var sTarget:String = first.second.third.fourth; var aTarget:Array = sTarget.split(.); var mcTarget = this[ aTarget[0] ]; for (var i:int = 1; i aTarget.length; i += 1) { mcTarget = mcTarget[ aTarget[i] ]; } trace( mcTarget ); / Viktor H On Thu, 12 Jun 2008 10:44:34 +0200, Ali Drongo [EMAIL PROTECTED] wrote: Hmmm, can anyone suggest the completed code? I can't see how this would work as you are returning a class reference that is named after the root object. Maybe I am missing something. Any suggestions much appreciated to keep me out of a long-hand switch statement :) Ali On 12 Jun 2008, at 04:48, Kerry Thompson wrote: Ali Drongo wrote: Hello, I'm being passed a string that has a reference to an object in dot-syntax like this: myOb.property.property2.property3 The object targeted may be a varying number of levels inside of the top-level object. I have tried to write this by turning the string into an array and then creating the object but I'm not sure how: public static function arToObj(a:Array):Object { var retObj:Object; for ( var i:Number=0; ia.length; i++ ) { if (i==a.length-1){ //dont know what to do here !! } }; return retObj; } This is untested e-mail ActionScript, but you could do something like this: public static function arToObj(a:String):Object { var strArray:Array; var clsRef:Class; strArray = a.split(.); clsRef = getDefinitionByName(strArray[0]) as Class; return new clsRef(); } I'm sure there are bugs in there, but that's the basic approach I'd take. Cordially, Kerry Thompson ___ 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 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ 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 -- Alistair Colling Interactive Developer FPP Brand Communications (Newcastle upon Tyne) The Courtyard Dinsdale Place Sandyford Newcastle upon Tyne NE2 1BD Telephone: +44 (0)191 261 6662 Fax: +44 (0)191 233 2511 This transmission is confidential and intended solely for the person or organisation to whom it is addressed. It may contain privileged and confidential information. If you are not the intended recipient, you should not copy, distribute or take any action in reliance on it. If you have received this transmission in error, please notify the sender at the e-mail address above. FPP Design Limited. Reg. Office: The Courtyard, Dinsdale Place, Sandyford, Newcastle upon Tyne NE2 1BD. Registered Number 3775564. Registered in England and Wales. Visit our website at http://www.fpp.net/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] as3 classes var query
You'd need to instantiate the other class and then access it, like this: That's one way, the other way is to use static variables: package com { class MyClass { public static var name:String = Johnny; //or declare as a public constant: public static const FRUIT:String = apple; } } import com.MyClass trace(MyClass.name); trace(MyClass.FRUIT); Jason Merrill Bank of America Global Technology Operations Global Risk LLD eTools Multimedia 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. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 classes var query
Ah thanks for all the help everyone. I'm slowly coming around to classes, as has been confused about when and when not to use classes and how to access the information from each other. interesting. Thanks again :) On Thu, Jun 12, 2008 at 3:38 PM, Merrill, Jason [EMAIL PROTECTED] wrote: You'd need to instantiate the other class and then access it, like this: That's one way, the other way is to use static variables: package com { class MyClass { public static var name:String = Johnny; //or declare as a public constant: public static const FRUIT:String = apple; } } import com.MyClass trace(MyClass.name); trace(MyClass.FRUIT); Jason Merrill Bank of America Global Technology Operations Global Risk LLD eTools Multimedia 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. ___ 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: How can I target an object from a dot-sytax string?
Ali Drongo wrote: Hello, I'm being passed a string that has a reference to an object in dot-syntax like this: myOb.property.property2.property3 The object targeted may be a varying number of levels inside of the top-level object. I have tried to write this by turning the string into an array and then creating the object but I'm not sure how: public static function arToObj(a:Array):Object { var retObj:Object; for ( var i:Number=0; ia.length; i++ ) { if (i==a.length-1){ //dont know what to do here !! } }; return retObj; } This is untested e-mail ActionScript, but you could do something like this: public static function arToObj(a:String):Object { var strArray:Array; var clsRef:Class; strArray = a.split(.); clsRef = getDefinitionByName(strArray[0]) as Class; return new clsRef(); } I'm sure there are bugs in there, but that's the basic approach I'd take. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - A simple questions
I would recommend using event.currentTarget instead of event.target at all times. the event.currentTarget property contains a reference to the instance at which you registered the event listener. event.target refers to the class that dispatches the event. In this case there is no difference between .target and .currentTarget, but in future cases you might encounter problems. The cases where you would use event.target are so rare that I would urge everyone to allways use event.currentTarget. Greetz Erik On 6/3/08, Rich Shupe [EMAIL PROTECTED] wrote: for (var i:int = 0; i 3; i++) { var txtFld:TextField = new TextField(); txtFld.name = TextField + i; txtFld.border = true; txtFld.x = i*120; addChild(txtFld); txtFld.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } function onClick(evt:Event):void { trace(Hi I'm, evt.target.name); } 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] AS3 - A simple questions
I use event.target in the current application I'm developing. It's nice in MouseEvents for determing what is currently under the mouse and not what dispatches the event. On Thu, 05 Jun 2008 14:17:43 +0200, EECOLOR [EMAIL PROTECTED] wrote: I would recommend using event.currentTarget instead of event.target at all times. the event.currentTarget property contains a reference to the instance at which you registered the event listener. event.target refers to the class that dispatches the event. In this case there is no difference between .target and .currentTarget, but in future cases you might encounter problems. The cases where you would use event.target are so rare that I would urge everyone to allways use event.currentTarget. Greetz Erik On 6/3/08, Rich Shupe [EMAIL PROTECTED] wrote: for (var i:int = 0; i 3; i++) { var txtFld:TextField = new TextField(); txtFld.name = TextField + i; txtFld.border = true; txtFld.x = i*120; addChild(txtFld); txtFld.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } function onClick(evt:Event):void { trace(Hi I'm, evt.target.name); } 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 -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ ___ 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] AS3 JSON.decode() not working :(
Hiya, I can't seem to get the JSON.decode() method to work. I have read a couple of blog tutorials and the string is tracing fine but when I pass it I get the message: Error: Unexpected j encountered at com.adobe.serialization.json::JSONTokenizer/parseError() at com.adobe.serialization.json::JSONTokenizer/getNextToken() at com.adobe.serialization.json::JSONDecoder/nextToken() at com.adobe.serialization.json::JSONDecoder() at com.adobe.serialization.json::JSON$/decode() at JSONExample/decodeJSON() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete() I'm not sure what I'm doing wrong, if someone could point me in the right direction it would be a big help. Cheers! Ali /// my code: private function createLoader():void { trace(createLoader); var request:URLRequest = new URLRequest(http://www.flickr.com/ services/feeds/photos_public.gne?tags=flexformat=json); loader = new URLLoader(); loader.load(request); loader.addEventListener(Event.COMPLETE, decodeJSON) } private function decodeJSON(event:Event):void { trace(event target:+event.target.data); var my_ar:Array = JSON.decode(event.target.data) ; } ps I'm also getting these error msgs when I compile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONEncoder( value:* ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONDecoder( s:String ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONTokenizer( s:String ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONToken.as(52): col: 19 Warning: The super () statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/deploy/ JSONExample.swf (4558 bytes) (fcsh) compile 1 Loading configuration file /Developer/SDKs/flex_sdk_3/frameworks/flex- config.xml Loading configuration file /Volumes/1alic07/AC_WorkingFolder/ Experiments/JSONExample/src/JSONExample-config.xml Recompile: /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/ src/JSONExample.as Reason: The source file or one of the included files has been updated. Files changed: 1 Files affected: 0 /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONEncoder.as(54): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONEncoder( value:* ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONDecoder.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function JSONDecoder( s:String ) { ^ /Volumes/1alic07/AC_WorkingFolder/Experiments/JSONExample/src/com/ adobe/serialization/json/JSONTokenizer.as(59): col: 19 Warning: The super() statement will be executed prior to entering this constructor. Add a call to super() within the constructor if you want to explicitly control when it is executed. public function
Re: [Flashcoders] AS3 - A simple questions
for (var i:int = 0; i 3; i++) { var txtFld:TextField = new TextField(); txtFld.name = TextField + i; txtFld.border = true; txtFld.x = i*120; addChild(txtFld); txtFld.addEventListener(MouseEvent.CLICK, onClick, false, 0, true); } function onClick(evt:Event):void { trace(Hi I'm, evt.target.name); } Rich http://www.LearningActionScript3.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 FTP Client?
try this one http://maliboo.riaforge.org/ it is open source, and working (very early version, as written) hth, Cedric Are there any FTP clients that run in AS3 for sale? Elia ___ 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 FTP Client?
Thanks, it appears to be an apollo project. I don't know if it will run in a browser with a plain as3 project. Elia - Original Message - From: Cedric Muller [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Monday, June 02, 2008 1:21 PM Subject: Re: [Flashcoders] AS3 FTP Client? did you look the project's home ? http://projects.maliboo.pl/FlexFTP/ Do you think I can use this in an AS3 project in Flex2? I went to the link but the SVN appears empty to me Elia - Original Message - From: Cedric Muller [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Monday, June 02, 2008 12:56 PM Subject: Re: [Flashcoders] AS3 FTP Client? try this one http://maliboo.riaforge.org/ it is open source, and working (very early version, as written) hth, Cedric Are there any FTP clients that run in AS3 for sale? Elia ___ 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
[Flashcoders] AS3 FTP Client?
Are there any FTP clients that run in AS3 for sale? Elia ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 FTP Client?
Do you think I can use this in an AS3 project in Flex2? I went to the link but the SVN appears empty to me Elia - Original Message - From: Cedric Muller [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Monday, June 02, 2008 12:56 PM Subject: Re: [Flashcoders] AS3 FTP Client? try this one http://maliboo.riaforge.org/ it is open source, and working (very early version, as written) hth, Cedric Are there any FTP clients that run in AS3 for sale? Elia ___ 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 FTP Client?
did you look the project's home ? http://projects.maliboo.pl/FlexFTP/ Do you think I can use this in an AS3 project in Flex2? I went to the link but the SVN appears empty to me Elia - Original Message - From: Cedric Muller [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Monday, June 02, 2008 12:56 PM Subject: Re: [Flashcoders] AS3 FTP Client? try this one http://maliboo.riaforge.org/ it is open source, and working (very early version, as written) hth, Cedric Are there any FTP clients that run in AS3 for sale? Elia ___ 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 GModeler?
I second violet uml. Pretty good and it's free! If you're looking for paying round trip UML- AS3, look into Enterprise Architect Romuald Quantin wrote: The most well-known as3 frameworks are: http://labs.adobe.com/wiki/index.php/Cairngorm http://puremvc.org/ A full list there: http://seantheflashguy.com/blog/2007/11/20/actionscript-30-uml-and-code-gene ration-tools/ If you're an eclipse user (which I recommend): http://alexdp.free.fr/violetumleditor/page.php cross-platform: http://staruml.sourceforge.net/en/ Romu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ali Drongo Sent: 28 May 2008 16:28 To: Flash Coders List Subject: [Flashcoders] AS3 GModeler? Hiya, I'm starting planning an AS3 project and have previously used Gmodeler to plan my classes. Are there any similar apps that will generate my stub classes in the same way GModeler did for AS2? Or can anyone recommend other AS3 // OOP planning apps they find useful? Cheers Ali ___ 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 Notice of confidentiality: The information contained in this e-mail is intended only for the use of the individual or entity named above and may be confidential. Should the reader of this message not be the intended recipient, you are hereby notified that any unauthorized dissemination, distribution or reproduction of this message is strictly prohibited. If you have received this message in error, please advise the sender immediately and destroy the e-mail. ___ 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
Re: [Flashcoders] AS3 - Dynamic Variable?
for (var i=1; i=5; i++) { trace(this.xmlClass.xmlData[RecImageW+i]); } should work hth, cedric 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 GModeler?
Hiya, I'm starting planning an AS3 project and have previously used Gmodeler to plan my classes. Are there any similar apps that will generate my stub classes in the same way GModeler did for AS2? Or can anyone recommend other AS3 // OOP planning apps they find useful? Cheers Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] AS3 GModeler?
The most well-known as3 frameworks are: http://labs.adobe.com/wiki/index.php/Cairngorm http://puremvc.org/ A full list there: http://seantheflashguy.com/blog/2007/11/20/actionscript-30-uml-and-code-gene ration-tools/ If you're an eclipse user (which I recommend): http://alexdp.free.fr/violetumleditor/page.php cross-platform: http://staruml.sourceforge.net/en/ Romu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ali Drongo Sent: 28 May 2008 16:28 To: Flash Coders List Subject: [Flashcoders] AS3 GModeler? Hiya, I'm starting planning an AS3 project and have previously used Gmodeler to plan my classes. Are there any similar apps that will generate my stub classes in the same way GModeler did for AS2? Or can anyone recommend other AS3 // OOP planning apps they find useful? Cheers Ali ___ 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 - calling / sending with vars
Another way to make the URLRequest is like this: *var urlVariables:URLVariables = new URLVariables(var1=1var2=10); var request:URLRequest = new URLRequest(http://url.com/;); request.data = urlVariables;* Greetz Erik On 5/27/08, Søren Christensen [EMAIL PROTECTED] wrote: Hi Viktor This was what I was looking for, thanks :-) Cheers, B) Søren On May 27, 2008, at 4:20 PM, Viktor Hesselbom wrote: var request:URLRequest = new URLRequest( http://url.com/?var1=1var2=10; ); sendToURL(request); ___ 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: Static functions and events ...
Is there anyway for a static function within a class to fire off an event? assuming the static function exists within a class that has no constructor (ie: is never instantiated). As I understand it, for another object to be listening for the event, said object must have a local refence to the class doing the dispatching? Anyway around this. SF. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Static functions and events ...
I just ran into this the other day, and I created a public static variable in the class called instance. When the static class is initialized via some sort of init() function, I create a sole, empty instance of the class whose only role is to dispatch events. Thus, when I have to assign a listener, I assign it to the instance, for example: public static var instance:SingletonClass ... public function SingletonClass() { } ... public static function init():void { instance = new SingletonClass(); } then, to add event listener SingletonClass.instance.addEventListener(SingletonClass.EVENT_NAME, listenerFunction); I'd love to hear about drawbacks to this approach. I'm sure there are some issues, and this was a new problem/idea. -jonathan On Thu, May 22, 2008 at 12:16 PM, Stephen Ford [EMAIL PROTECTED] wrote: Is there anyway for a static function within a class to fire off an event? assuming the static function exists within a class that has no constructor (ie: is never instantiated). As I understand it, for another object to be listening for the event, said object must have a local refence to the class doing the dispatching? Anyway around this. SF. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Static functions and events ...
Grant Skinner has created a nice solution for it: http://www.gskinner.com/blog/archives/2007/07/building_a_stat_1.html On Thu, May 22, 2008 at 1:56 PM, jonathan howe [EMAIL PROTECTED] wrote: I just ran into this the other day, and I created a public static variable in the class called instance. When the static class is initialized via some sort of init() function, I create a sole, empty instance of the class whose only role is to dispatch events. Thus, when I have to assign a listener, I assign it to the instance, for example: public static var instance:SingletonClass ... public function SingletonClass() { } ... public static function init():void { instance = new SingletonClass(); } then, to add event listener SingletonClass.instance.addEventListener(SingletonClass.EVENT_NAME, listenerFunction); I'd love to hear about drawbacks to this approach. I'm sure there are some issues, and this was a new problem/idea. -jonathan On Thu, May 22, 2008 at 12:16 PM, Stephen Ford [EMAIL PROTECTED] wrote: Is there anyway for a static function within a class to fire off an event? assuming the static function exists within a class that has no constructor (ie: is never instantiated). As I understand it, for another object to be listening for the event, said object must have a local refence to the class doing the dispatching? Anyway around this. SF. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101 ___ 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 - 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
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
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
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
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] AS3: Stretch only edges of a displayObject?I
I am looking to take a DO (movieclip), and stretch just the side edges, leaving the middle unstretched... so take an image, cut in 4 vertical pieces, and stretch the outside pieces out horizontally by like 15%. I could use DisplayObjects above the main one and just stretch those horizontally, but I really want to keep this contained to manipulations on the main object itself and not worry about creating and destroying others. Any ideas? ___ 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] AS3 - Upload image problem
Hi, If you are using PHP, remember to use the getimagesize() function to add a bit of security to your upload script - if someone is trying to spoof the image, it can add an extra level of security - possibly not foolproof, but pretty good. It's something like getimagesize($_FILES['myFileName']['tmpname']) for normal HTML forms, maybe slightly different for Flash - look at some of the Flash tut's for this. HTH Glen SJM - Flash wrote: 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
Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I
Eric, if you're saying you want to manipulate the first and last 15% of a display object without creating anything else, I don't think that's possible. The closest I can think of that will accomplish that is using a displacement map filter in conjunction with resizing. That might get you what you need, but you'll still have to create the displacement map. Another way to do this is to create and destroy other objects but within the main object. At least that way you won't have to worry about moving, rotating, etc., four slices. You could use BitmapData, for example, create the four slices and add them inside the same do, allowing you to manipulate only slices 1 and 4, but still treat the entire d.o. as a single entity. On 5/20/08 9:44 AM, eric e. dolecki wrote: I am looking to take a DO (movieclip), and stretch just the side edges, leaving the middle unstretched... so take an image, cut in 4 vertical pieces, and stretch the outside pieces out horizontally by like 15%. I could use DisplayObjects above the main one and just stretch those horizontally, but I really want to keep this contained to manipulations on the main object itself and not worry about creating and destroying others. Rich http://www.LearningActionScript3.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I
While I don't seem to be able to do this easily, I am applying scale9grid to sorta do what I want. I was hoping for incremental stretching on the sides... maybe that is something I'll be able to do using a hydra filter or something in FP10. On Tue, May 20, 2008 at 12:47 PM, Rich Shupe [EMAIL PROTECTED] wrote: Eric, if you're saying you want to manipulate the first and last 15% of a display object without creating anything else, I don't think that's possible. The closest I can think of that will accomplish that is using a displacement map filter in conjunction with resizing. That might get you what you need, but you'll still have to create the displacement map. Another way to do this is to create and destroy other objects but within the main object. At least that way you won't have to worry about moving, rotating, etc., four slices. You could use BitmapData, for example, create the four slices and add them inside the same do, allowing you to manipulate only slices 1 and 4, but still treat the entire d.o. as a single entity. On 5/20/08 9:44 AM, eric e. dolecki wrote: I am looking to take a DO (movieclip), and stretch just the side edges, leaving the middle unstretched... so take an image, cut in 4 vertical pieces, and stretch the outside pieces out horizontally by like 15%. I could use DisplayObjects above the main one and just stretch those horizontally, but I really want to keep this contained to manipulations on the main object itself and not worry about creating and destroying others. 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] AS3: Stretch only edges of a displayObject?I
Maybe this will work? Make two copies of the original MovieClip (if you're loading an image, load it once into the first clip, then when it's done loading, load it into the two others) for a total of three. Mask the left and right pieces to the width you want to show. Mask the middle piece so those edges aren't showing. Determine the math that you would have to stretch each one of the slices so that that portion would be stretched 15% (it will be more than 15% because you would have to take into account the width of the entire clip) and set their scalex to that value. Position their x so they're lined up correctly. Voila! eric e. dolecki wrote: I am looking to take a DO (movieclip), and stretch just the side edges, leaving the middle unstretched... so take an image, cut in 4 vertical pieces, and stretch the outside pieces out horizontally by like 15%. I could use DisplayObjects above the main one and just stretch those horizontally, but I really want to keep this contained to manipulations on the main object itself and not worry about creating and destroying others. Any ideas? ___ 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: Stretch only edges of a displayObject?I
That was going to be an approach... and I would apply the stretch to the sides loaded in on top by hand in Photoshop (cementing the effect -- bad voodoo there). Then I thought it might be cool to do it using the BitmapData class somehow instead so I didn't need to worry about any cleanup, etc. as much as the image will be changing a lot, etc. I'm investigating Pixel Bender right now. On Tue, May 20, 2008 at 1:48 PM, Steven Sacks [EMAIL PROTECTED] wrote: Maybe this will work? Make two copies of the original MovieClip (if you're loading an image, load it once into the first clip, then when it's done loading, load it into the two others) for a total of three. Mask the left and right pieces to the width you want to show. Mask the middle piece so those edges aren't showing. Determine the math that you would have to stretch each one of the slices so that that portion would be stretched 15% (it will be more than 15% because you would have to take into account the width of the entire clip) and set their scalex to that value. Position their x so they're lined up correctly. Voila! eric e. dolecki wrote: I am looking to take a DO (movieclip), and stretch just the side edges, leaving the middle unstretched... so take an image, cut in 4 vertical pieces, and stretch the outside pieces out horizontally by like 15%. I could use DisplayObjects above the main one and just stretch those horizontally, but I really want to keep this contained to manipulations on the main object itself and not worry about creating and destroying others. Any ideas? ___ 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: Stretch only edges of a displayObject?I
You can almost certainly write a Hydra filter for this. You can do it AS-native with BitmapData. 9-slice scaling can't do what you're hoping for, as I understand it. It will only scale the top and bottom centers when scaling left and right, the left and right centers when scaling up and down, the center slice in all cases, and never the corners. If you want something *very* roughly like the genie effect (where the top and bottom scale but not the middle, or vice-versa), you'll need to write something for that. There are bunch of examples like this if you want to think a bit about what to search for. I can think of the genie effect, an old-school waving flag or skew, etc., all of which cut the object into slices and manipulate them individually. In fact, this is required when using 9-slice on a bitmap. You have to cut the BM along the lines of the scale-9 rect so the auto scaling will work properly. (You can do it manually before importing, too, but that's obviously not dynamic.) Another thing that was quite popular was the slice-distortion of a single image--the first I saw was the Mona Lisa--depending on where you hovered your mouse. I just did a search for mona lisa actionscript with no luck, but this might jog some gray cells into action. You might also look for an ActionScript goo/liquify example which would demonstrate a displacement map approach. I think Grant did one of Mike Chambers. I'll try to pull this into focus when I have a clearer head and maybe I can think of a concrete link or two. R On 5/20/08 1:35 PM, eric e. dolecki [EMAIL PROTECTED] wrote: While I don't seem to be able to do this easily, I am applying scale9grid to sorta do what I want. I was hoping for incremental stretching on the sides... maybe that is something I'll be able to do using a hydra filter or something in FP10. Rich http://www.LearningActionScript3.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Stretch only edges of a displayObject?I
crud. anyone remember how to load a filter? ;) On Tue, May 20, 2008 at 2:27 PM, Rich Shupe [EMAIL PROTECTED] wrote: You can almost certainly write a Hydra filter for this. You can do it AS-native with BitmapData. 9-slice scaling can't do what you're hoping for, as I understand it. It will only scale the top and bottom centers when scaling left and right, the left and right centers when scaling up and down, the center slice in all cases, and never the corners. If you want something *very* roughly like the genie effect (where the top and bottom scale but not the middle, or vice-versa), you'll need to write something for that. There are bunch of examples like this if you want to think a bit about what to search for. I can think of the genie effect, an old-school waving flag or skew, etc., all of which cut the object into slices and manipulate them individually. In fact, this is required when using 9-slice on a bitmap. You have to cut the BM along the lines of the scale-9 rect so the auto scaling will work properly. (You can do it manually before importing, too, but that's obviously not dynamic.) Another thing that was quite popular was the slice-distortion of a single image--the first I saw was the Mona Lisa--depending on where you hovered your mouse. I just did a search for mona lisa actionscript with no luck, but this might jog some gray cells into action. You might also look for an ActionScript goo/liquify example which would demonstrate a displacement map approach. I think Grant did one of Mike Chambers. I'll try to pull this into focus when I have a clearer head and maybe I can think of a concrete link or two. R On 5/20/08 1:35 PM, eric e. dolecki [EMAIL PROTECTED] wrote: While I don't seem to be able to do this easily, I am applying scale9grid to sorta do what I want. I was hoping for incremental stretching on the sides... maybe that is something I'll be able to do using a hydra filter or something in FP10. 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] AS3: Stretch only edges of a displayObject?I
Eric, I know this isn't the root of what you were asking, but here's a class by Thibault Imbert that brings 9-slice scaling to bitmaps. Not on point, but related: http://www.bytearray.org/?p=118 And if anyone is interested, donate to his book. And if there are any fluent French speakers willing to contribute translation efforts, let me know. Rich http://www.LearningActionScript3.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 : Flash IDE Base Class question ...
Hi Stephen, On the Export for Actionscript dialog there is a pencil which brings up your class if you click it. But if you haven't written a class yet then the dialog says it will create one for you (when compiled), based on MovieClip. If you have written a class then you get what you want instead. I suppose they take the generic case since a MovieClip (an extended Sprite) can do anything a Sprite can. John //Is the compiler now using Sprite as the Base Class for my Box class (as per the Class definition) or is it still using MovieClip (as per the IDE)? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 : Flash IDE Base Class question ...
Example: I've drawn a 50x50 red square in the Flash IDE, and converted it to a new MovieClip, giving it a name of Box. I've then selected Export for Actionscript, at which point said clip is given the default Base Class of: flash.display.MovieClip So I then create a Class file, Box.as. Within this Class definition, I use the following: public class Box extends Sprite So my question: Is the compiler now using Sprite as the Base Class for my Box class (as per the Class definition) or is it still using MovieClip (as per the IDE)? So the short version: What is the correlation between a clip's Base Class within the IDE and the Class which it extends (if any) within it's Class definition (if defined/created). Cheers, Stephen.___ 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] 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
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
Re: [Flashcoders] AS3 - Embeding Fonts
I am not sure what you are talking about, but using Flex Builder 3 and an ActionScript project, this code works fine: *package { import flash.display.Sprite; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import fly.easing.Tween; * * public class EmbedFontTest extends Sprite { [Embed(source=C:\\WINDOWS\\Fonts\\ARIAL.TTF, fontFamily=Arial)] ** **private var _arial_str:String; ** **private var _arial_fmt:TextFormat; ** **private var _text_txt:TextField; ** ** **public function EmbedFontTest() ** **{ ** ** **super(); ** ** **this.initEmbedFontTest(); ** **} ** ** **private function initEmbedFontTest():void ** **{ ** ** **this._arial_fmt = new TextFormat(); ** ** **this._arial_fmt.font = Arial; ** ** **this._arial_fmt.size = 40; ** ** ** **this._text_txt = new TextField(); ** ** **this._text_txt.embedFonts = true; ** ** **this._text_txt.autoSize = TextFieldAutoSize.LEFT; ** ** **this._text_txt.defaultTextFormat = this._arial_fmt; ** ** **this._text_txt.text = Test Arial Format; ** ** ** **this.addChild(this._text_txt); ** **} } }* Ahh, I re-read the the last question, hehe: is the only way to embed the font in the IDE?? Yes, you can not use AS3 to embed fonts if you are compiling using Flash CS3. I am not sure what the problem is though. If you are compiling with Flash CS3 anyway you have a way to embed them. If you insist on embedding fonts using ActionsScript, you might consider downloading the Flex 3 SDK or Flex Builder 3. The Flex SDK contains a compiler that can compile ActionScript projects. You could use this compiler to compile your fonts into separate swf and load those in. Flash doesn't understand any meta tags. This is correct, Flash CS3 does not understand the metadata tags. The ActionScript compiler from the Flex SDK does understand them, but not all of them are usefull, most important, the [RemoteClass] and [Bindable] tags can not be used in an ActionScript project. The Flex compiler does understand them and also uses all of the Adobe provided ones. Greetz Erik On 5/15/08, SJM [EMAIL PROTECTED] wrote: 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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Embeding Fonts
I don't think you can use Flex style meta tags in Flash - at least it has never worked for me. But with Astro device fonts act like embedded fonts (anti-aliased etc) so that I will get away with not using embedded fonts too much - well I am hoping so but may be I'm wrong :) Kenneth Kawamoto http://www.materiaprima.co.uk/ SJM wrote: 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
RE: [Flashcoders] as3 namespace question
Thanks for the response Erik. Yes, I am aware that compiling the entire base class of another swf is problematic. I was just trying to simplify things for the example. If the idea works I will to use an interface as a public api to the loaded swf. Anyway, I am very interested in seeing your example files, whether in Flex or Flash. However, I don't seem to receive attachments sent through this list. Can you send me the attachment off list? Thanks Dave -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of EECOLOR Sent: Tuesday, May 13, 2008 5:38 PM To: Flash Coders List Subject: Re: [Flashcoders] as3 namespace question And now the attachment, hehe. Greetz Erik On 5/13/08, EECOLOR [EMAIL PROTECTED] wrote: I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. There were some concrete answers posted to your question. Anyway, let's see if we can solve it again. Before I will try and help with your problem, I want to point out something about your code. I am not sure if you are using (in your real application) an interface which you will cast your class to: *var _lm:ILoadMe = ILoadMe(_ldr.content);* If you are using the actual class, the problem is that the whole class and it's dependencies are compiled into you main swf, defeating a big part of the purpose of loading the swf into it. In my previous reply to your earlier email I posted a Flex version of the answer. This time I created a Flash example. It is added as attachment. The attached zip file contains 2 directories. Make sure you have your webserver point to to these directories, the virtual hosts in apache: *VirtualHost *:80 ServerName domain1 DocumentRoot E:\Projects\domain1 /VirtualHost VirtualHost *:80 ServerName domain2 DocumentRoot E:\Projects\domain2 /VirtualHost* In the hosts file (if you are on windows) you need these 2 entries: *127.0.0.1 domain1 127.0.0.1 domain2* In order to test the example, call this url: *http://domain1/domain1.html* You should see this appear on your screen: *domain1.swf domain2.swf loaded Domain2Base* I hope this will solve your problem. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. There were some concrete answers posted to your question. Anyway, let's see if we can solve it again. Before I will try and help with your problem, I want to point out something about your code. I am not sure if you are using (in your real application) an interface which you will cast your class to: *var _lm:ILoadMe = ILoadMe(_ldr.content);* If you are using the actual class, the problem is that the whole class and it's dependencies are compiled into you main swf, defeating a big part of the purpose of loading the swf into it. In my previous reply to your earlier email I posted a Flex version of the answer. This time I created a Flash example. It is added as attachment. The attached zip file contains 2 directories. Make sure you have your webserver point to to these directories, the virtual hosts in apache: *VirtualHost *:80 ServerName domain1 DocumentRoot E:\Projects\domain1 /VirtualHost VirtualHost *:80 ServerName domain2 DocumentRoot E:\Projects\domain2 /VirtualHost* In the hosts file (if you are on windows) you need these 2 entries: *127.0.0.1 domain1 127.0.0.1 domain2* In order to test the example, call this url: *http://domain1/domain1.html* You should see this appear on your screen: *domain1.swf domain2.swf loaded Domain2Base* I hope this will solve your problem. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
And now the attachment, hehe. Greetz Erik On 5/13/08, EECOLOR [EMAIL PROTECTED] wrote: I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. There were some concrete answers posted to your question. Anyway, let's see if we can solve it again. Before I will try and help with your problem, I want to point out something about your code. I am not sure if you are using (in your real application) an interface which you will cast your class to: *var _lm:ILoadMe = ILoadMe(_ldr.content);* If you are using the actual class, the problem is that the whole class and it's dependencies are compiled into you main swf, defeating a big part of the purpose of loading the swf into it. In my previous reply to your earlier email I posted a Flex version of the answer. This time I created a Flash example. It is added as attachment. The attached zip file contains 2 directories. Make sure you have your webserver point to to these directories, the virtual hosts in apache: *VirtualHost *:80 ServerName domain1 DocumentRoot E:\Projects\domain1 /VirtualHost VirtualHost *:80 ServerName domain2 DocumentRoot E:\Projects\domain2 /VirtualHost* In the hosts file (if you are on windows) you need these 2 entries: *127.0.0.1 domain1 127.0.0.1 domain2* In order to test the example, call this url: *http://domain1/domain1.html* You should see this appear on your screen: *domain1.swf domain2.swf loaded Domain2Base* I hope this will solve your problem. Greetz Erik ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] as3 namespace question
I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. I need to load an swf from one server that is a member of some class. For example: http://server1.mydomain.com/load_me.swf that uses the Document class com.mydomain.componet.LoadMe.as. I want to be able to load this swf from a different server, say http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when it is done loading. Should this work? I keep getting errors when trying to cast in the init handler. import com.mydomain.componet.LoadMe; var _req:URLRequest = new URLRequest(http://server1.mydomain.com/load_me.swf;); var _ldr:Loader = new Loader(); var _context:LoaderContext = new LoaderContext(); _context.securityDomain = SecurityDomain.currentDomain; _context.applicationDomain = ApplicationDomain.currentDomain; _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false, 0, true); _ldr.load(_req, _context); private function initHandler($event:Event) () { var _lm:LoadMe = LoadMe(_ldr.content); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 namespace question
I have not tryed this, but check this: http://livedocs.adobe.com/flex/201/langref/flash/display/LoaderInfo.html Because the instance of the main class of the SWF file has no Loader object, the loaderInfo property is the only way to access the LoaderInfo for the instance of the main class of the SWF file. Perhaps this means you have to do something like: private function initHandler($event:Event) () { var _lm:LoadMe = LoadMe(_ldr.loaderInfo.content); } Cheers Juan Pablo Califano 2008/5/9, Dave Segal [EMAIL PROTECTED]: I posted about this before and didn't receive and answer but it is still causing me issues so I am trying again. I need to load an swf from one server that is a member of some class. For example: http://server1.mydomain.com/load_me.swf that uses the Document class com.mydomain.componet.LoadMe.as. I want to be able to load this swf from a different server, say http://server2.mydomain.com/load_stuff.swf, and cast it to a LoadMe when it is done loading. Should this work? I keep getting errors when trying to cast in the init handler. import com.mydomain.componet.LoadMe; var _req:URLRequest = new URLRequest(http://server1.mydomain.com/load_me.swf;); var _ldr:Loader = new Loader(); var _context:LoaderContext = new LoaderContext(); _context.securityDomain = SecurityDomain.currentDomain; _context.applicationDomain = ApplicationDomain.currentDomain; _ldr.contentLoaderInfo.addEventListener(Event.INIT, initHandler, false, 0, true); _ldr.load(_req, _context); private function initHandler($event:Event) () { var _lm:LoadMe = LoadMe(_ldr.content); } ___ 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- Word Wrap for Dynamic DataGrid Cell Content
Does anybody have any code that sets the cells in a DataGrid so they display text content to automatically word wrap instead of displaying single line? This is for Flash CS3/ Actionscript 3. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 For loop proplem
Since you have not set x,y for the MovieClips, might the others be underneath the top one (last loaded)? John - Original Message - From: [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Tuesday, May 06, 2008 5:54 PM Subject: [Flashcoders] AS3 For loop proplem 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, whats going wrong? 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 ___ 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 sound and swf overriding one another
Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] as3 sound and swf overriding one another
Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 sound and swf overriding one another
Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 sound and swf overriding one another
Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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 sound and swf overriding one another
Apologies, I misunderstood what you wanted to do. If you google around for sound and embedded flv people seem to be having a few problems so I am guessing this may be a bigger issue and would not surprise me if there is a bug in there somewhere or maybe a feature of the player. I had one a while ago where calling stopallsounds stopped all sounds, across every browser tab - f*g annoying if you are listening to internet radio or similar. Sorry I can't be any more help... Glen quinrou . wrote: Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
no problem, I think i have sort of managed to locate the bug to when and where it occures My mp3 stops playing everytime a swf gets loaded regardless of it containing a flv or not. this pure madness... thanks On Tue, May 6, 2008 at 2:08 PM, Glen Pike [EMAIL PROTECTED] wrote: Apologies, I misunderstood what you wanted to do. If you google around for sound and embedded flv people seem to be having a few problems so I am guessing this may be a bigger issue and would not surprise me if there is a bug in there somewhere or maybe a feature of the player. I had one a while ago where calling stopallsounds stopped all sounds, across every browser tab - f*g annoying if you are listening to internet radio or similar. Sorry I can't be any more help... Glen quinrou . wrote: Hi Glen, I know I need to invoke the stop method to stop a sound object but what I am looking for is to have my mp3 and the sound in the swf playing at the same time. what is happening at the moment is that the sound in the swf overrides the mp3 soundchannel and therefore causes the mp3 to stop without me calling the stop method. thanks On Tue, May 6, 2008 at 1:38 PM, Glen Pike [EMAIL PROTECTED] wrote: Hi, If you want to stop the Embedded sound playing you need to save the SoundChannel object returned from calling play() on the Sound object: I guess you need to call stop() on your sound channel when your SWF loads. Here is a snippet of my code for a game - I stored my sound assets in a single object, in which I also put any SoundChannel objects that I had for looping sounds or sounds I wanted to stop / manipulate: [Embed (source = ../resources/graphics.swf, symbol=MotherShip)] private var MotherShip:Class; _sounds = new Object(); _sounds.mothership = new SndMotherShip() as SoundAsset; _sounds.mothership_stop = _sounds.mothership.play(0, 100) as SoundChannel; //trace(showMotherShip + _sounds.mothership_stop); var pan:Number = ( _motherShip.x / _width) - 0.5; SoundChannel(_sounds.mothership_stop).soundTransform = new SoundTransform(1, pan); HTH Glen quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 -- 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
Re: [Flashcoders] as3 sound and swf overriding one another
the completeHandler is only to re dispatch the channels SOUND_COMPLETE private function completeHandler(event: Event): void { dispatchEvent(new Event(Event.SOUND_COMPLETE)); } The Application (the mp3 player in this case) listens to the SOUND_COMPLETE and then starts a new song, after the new url is taken from the playlist. No fancy stuff there ;) Folkert quinrou . wrote: Sidney, Thanks for this but I think i will need to get the explaination coz the code isn't fully there. i.e. There no method completeHandler which is used in the last example which is i think the one I am the most interested in since it looks very similar to the on I have. Anyone else who has a solution for this problem? thanks On Tue, May 6, 2008 at 12:43 PM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Quinrou, I have exactly the same with an AIR project i'm building. I have not found a fix, there is an explanation i'm reading right now, it is in dutch, however the code should help you. http://nederflash.nl/blog/as3-tips%3A-error-2029-uitgelegt#comment-42 Hope this helps you, Sidney On May 6, 2008, at 1:22 PM, quinrou . wrote: Hi all, I am having a very strange behavior with the Sound object. I will try to describe the problem as accurate as possible. I have a mp3 which I have embedded in class like this [Embed(source='../../../../../embedded_assets/mp3/loop.mp3')] private var Loop:Class; This mp3 plays when the application starts and keeps on looping. However as soon as a swf with an embedded flv on the timeline (which also contains sound) starts playing the mp3 then stops playing. there's no code which tell mp3 to stop playing when the swf starts... It looks like the swf overrides the mp3 sound channel. Has anyone experienced behavior and how did ou manage to fix the problem. Many thanks ___ 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 For loop proplem
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, whats going wrong? 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 For loop proplem
is your loadLibrary function is returning the same thing each time?? [EMAIL PROTECTED] wrote: 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, whats going wrong? 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 ___ 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
RE: [Flashcoders] AS3 For loop proplem
Hi SJM, It looks like you're setting the persistent var, _mcName, to equal each _summaryElement[i].sumImg in turn as the loop progresses. That means that when the loop is finished, the value for _mcName will be a reference to _summaryElement[4].sumImg, the last clip being loaded. Since your loop undoubtedly runs faster than the loading process, what your imgLoadComplete handler is actually doing is this, _summaryElement[4].sumImg.addChild(ev.target.content). It wouldn't be surprising if you looked at the contents of _summaryElement[4].sumImg and found that all the images are added to its display list as each load completes. I would either get rid of the persistent var and find a way to use an ID number to link the loaded images and the containers, OR add this line to your loadImage method, _mcName.addChild(imageLoader);, and forget the event listener (at least for doing the addChild). Hth, Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 9:54 AM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] AS3 For loop proplem 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, whats going wrong? 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 ___ 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 For loop proplem
Hi SJM I am trying to reproduce it for you. Whats in : locationInfo.item ___ 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
var summaryClick = function (ev:Event) { trace(i); // Outputs incorrectly (Outputs 5 on each MovieClip click) ??? } Outputs correctly: 5 *is* the value of i when clicked. Regards, -Keith http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] Problem with For loop
var summaryClick = function (ev:Event) { trace(i); // Outputs incorrectly (Outputs 5 on each MovieClip click) ??? } i does not exist within your loaded MovieClip. You need to trace a variable that is specific to the MovieClip. Charles P. On Fri, May 2, 2008 at 10:58 AM, SJM - Flash [EMAIL PROTECTED] 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 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
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
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] (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
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
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
RE: [Flashcoders] (AS3) Object to an Array
Or SWX format http://www.swxformat.org/ Pete -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Muzak Sent: 29 April 2008 14:09 To: Flash Coders List 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 __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ 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
Hi, This may be a formatting thing with how you post arrays and my answer may need revising: Look in the PHP manual for Variables from outside PHP and see that you can post arrays from HTML forms, by having the fields named as an array.. so my original code below is a bit wrong, sorry. The loop will have to build the pseudo array for each text var object so you can post textVars[0][a]=0textVars[0][b]=1, etc.: setVars = new Object(); 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]); //check the quotes and braces carefully, but basically you want to end up with setVars.textVars[0][a] = 0, etc setVars[textVars[ + i + ][ + itm + ]] = obj[itm]; } } I think that may fix it... You probably also want to make sure your PHP script is behaving by temporarily changing $_POST to $_REQUEST then writing a manual query string as above... HTH Glen SJM - Flash wrote: 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
Re: [Flashcoders] (AS3) Object to an Array
You can also use JSON, a format close to javascript syntax, used for serializing / deserializing objects. It's rather standard and you can find libraries for parsing it in most mainstream languages (including, of course, AS 2.0 AS 3.0, and PHP) Cheers Juan Pablo Califano 2008/4/29, SJM - Flash [EMAIL PROTECTED]: 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
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
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
[Flashcoders] { AS3 } Reading position info X, Y, H W
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
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
RE: [Flashcoders] { AS3 } Reading position info X, Y, H W
Surely - by Pythagoras w2 = square root of (width - x)^2 + (x2 - x)^2 Also might help to know the _rotation angle of the containing element -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 28 April 2008 14:43 To: Flash Coders List Subject: [Flashcoders] { AS3 } Reading position info X, Y, H W 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 __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ 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
Re: [Flashcoders] { AS3 } Reading position info X, Y, H W
Hi, Sorry I see you are using Flash not Flex, I gotta stop doing that. If you are using Flash, just changing the rotation should work straight away - you will see it on screen - don't worry about validateNow() (If you are using Flex and change properties of a UIComponent, you may need to call validateNow on that component before it updates the display, hence other properties.) To be honest, Pythagoras is easier and more robust than this and if you are programming graphics, it should be in your arsenal - see the other guys' reply for a solution, but have a go at working it out first if you can. Glen SJM - Flash wrote: 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 -- 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] AS3/E4X Problems porting from AS2
I'm in the process of switching some of my apps over to AS3, with one class used to access and XML object giving me a fits. The class is used to navigate through a serious of pages, with the XML acting like the table of contents (chapter/topic/page). Applications using this class would make calls like myClass.nextPage() and be given the location of the swf to load, as well as other metadata about that page. Simple enough in AS2. When the XML loads, I grab a reference to the first page in the book and store it in a class variable (psudo code): _currentPage = _toc.firstChild.firstChild.firstChild ; and then subsequent calls to nextPage would use: _currentPage =_currentPage.nextSibling ; return _currentPage ; The code itself seems simple to port to AS3, however, I'm not getting the results I'm expecting: _currentPage = _toc.chapter[0].topic[0].page[0] ; works fine however _currentPage =_currentPage.parent().children()[node.childIndex() + 1]; return _currentPage ; causes an error. The failure appears to be _currentPage.parent() as this is returning null. So after that long winded description, my fear/guess at this point is that the XML object _currentPage when set by _toc.chapter[0].topic[0].page[0] is creating an *isolated XML fragment* with no connection to the parent XML object. This differs from how I was working in AS2, where the XMLNode _currentPage behaved like a pointer to the position of the node within the XML object. Is this assumption correct? If so, know any way of getting around it? Would using _currentPage as an XMLNode solve the problem, and if so, is it possible to perform E4X filters/searches on an XMLNode or is it back to XPath for AS3? Jer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3/E4X Problems porting from AS2
When porting from AS2, you might find it more direct to use XMLDocument instead of XML. This behaves exactly like the AS2 XML object. Having said that, I tried your code and it seemed to work (I assumed where you put node.childIndex() it was a typo and you meant to write _currentPage.childIndex()). Peter On Wed, Apr 16, 2008 at 7:41 PM, Jer Brand [EMAIL PROTECTED] wrote: I'm in the process of switching some of my apps over to AS3, with one class used to access and XML object giving me a fits. The class is used to navigate through a serious of pages, with the XML acting like the table of contents (chapter/topic/page). Applications using this class would make calls like myClass.nextPage() and be given the location of the swf to load, as well as other metadata about that page. Simple enough in AS2. When the XML loads, I grab a reference to the first page in the book and store it in a class variable (psudo code): _currentPage = _toc.firstChild.firstChild.firstChild ; and then subsequent calls to nextPage would use: _currentPage =_currentPage.nextSibling ; return _currentPage ; The code itself seems simple to port to AS3, however, I'm not getting the results I'm expecting: _currentPage = _toc.chapter[0].topic[0].page[0] ; works fine however _currentPage =_currentPage.parent().children()[node.childIndex() + 1]; return _currentPage ; causes an error. The failure appears to be _currentPage.parent() as this is returning null. So after that long winded description, my fear/guess at this point is that the XML object _currentPage when set by _toc.chapter[0].topic[0].page[0] is creating an *isolated XML fragment* with no connection to the parent XML object. This differs from how I was working in AS2, where the XMLNode _currentPage behaved like a pointer to the position of the node within the XML object. Is this assumption correct? If so, know any way of getting around it? Would using _currentPage as an XMLNode solve the problem, and if so, is it possible to perform E4X filters/searches on an XMLNode or is it back to XPath for AS3? Jer ___ 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/E4X Problems porting from AS2
yeah, typo (copied code without changing the names to make any sense in the context of this post). If that code is working, I may have a more subtle bug working somewhere...I'm going to guess that it may be from running a filter and setting the XMLList directly to an XML object -- Either way, somehow the link to the parent XML document is being stripped between calls to nextPage(). Thanks for the confirmation. I'll post back if I learn anything new (unless I have a really stupid typo or some such nonsense). On Wed, Apr 16, 2008 at 1:46 PM, Peter Hall [EMAIL PROTECTED] wrote: When porting from AS2, you might find it more direct to use XMLDocument instead of XML. This behaves exactly like the AS2 XML object. Having said that, I tried your code and it seemed to work (I assumed where you put node.childIndex() it was a typo and you meant to write _currentPage.childIndex()). Peter On Wed, Apr 16, 2008 at 7:41 PM, Jer Brand [EMAIL PROTECTED] wrote: I'm in the process of switching some of my apps over to AS3, with one class used to access and XML object giving me a fits. The class is used to navigate through a serious of pages, with the XML acting like the table of contents (chapter/topic/page). Applications using this class would make calls like myClass.nextPage() and be given the location of the swf to load, as well as other metadata about that page. Simple enough in AS2. When the XML loads, I grab a reference to the first page in the book and store it in a class variable (psudo code): _currentPage = _toc.firstChild.firstChild.firstChild ; and then subsequent calls to nextPage would use: _currentPage =_currentPage.nextSibling ; return _currentPage ; The code itself seems simple to port to AS3, however, I'm not getting the results I'm expecting: _currentPage = _toc.chapter[0].topic[0].page[0] ; works fine however _currentPage =_currentPage.parent().children()[node.childIndex() + 1]; return _currentPage ; causes an error. The failure appears to be _currentPage.parent() as this is returning null. So after that long winded description, my fear/guess at this point is that the XML object _currentPage when set by _toc.chapter[0].topic[0].page[0] is creating an *isolated XML fragment* with no connection to the parent XML object. This differs from how I was working in AS2, where the XMLNode _currentPage behaved like a pointer to the position of the node within the XML object. Is this assumption correct? If so, know any way of getting around it? Would using _currentPage as an XMLNode solve the problem, and if so, is it possible to perform E4X filters/searches on an XMLNode or is it back to XPath for AS3? Jer ___ 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/E4X Problems porting from AS2
And the problem becomes obvious... once I think about it. AS2's to attempt to execute code on a variable containing null was used over and over to determine when I reached the end of a set of pages in a particular topic. Code like switch(node.nodeName) ... case undefined: Happily executes and let me know when I reached the end of a particular section. switch(node.localName()) crashes and burns. Would have found this much earlier if the error wasn't somehow delaying output so it appeared to be breaking much earlier in the process -- it appeared to break on the second page not the 6th and end of the topic. Thanks for the help Peter. (and I hate it when I get worked up over stupid mistakes!) On Wed, Apr 16, 2008 at 1:46 PM, Peter Hall [EMAIL PROTECTED] wrote: When porting from AS2, you might find it more direct to use XMLDocument instead of XML. This behaves exactly like the AS2 XML object. Having said that, I tried your code and it seemed to work (I assumed where you put node.childIndex() it was a typo and you meant to write _currentPage.childIndex()). Peter On Wed, Apr 16, 2008 at 7:41 PM, Jer Brand [EMAIL PROTECTED] wrote: I'm in the process of switching some of my apps over to AS3, with one class used to access and XML object giving me a fits. The class is used to navigate through a serious of pages, with the XML acting like the table of contents (chapter/topic/page). Applications using this class would make calls like myClass.nextPage() and be given the location of the swf to load, as well as other metadata about that page. Simple enough in AS2. When the XML loads, I grab a reference to the first page in the book and store it in a class variable (psudo code): _currentPage = _toc.firstChild.firstChild.firstChild ; and then subsequent calls to nextPage would use: _currentPage =_currentPage.nextSibling ; return _currentPage ; The code itself seems simple to port to AS3, however, I'm not getting the results I'm expecting: _currentPage = _toc.chapter[0].topic[0].page[0] ; works fine however _currentPage =_currentPage.parent().children()[node.childIndex() + 1]; return _currentPage ; causes an error. The failure appears to be _currentPage.parent() as this is returning null. So after that long winded description, my fear/guess at this point is that the XML object _currentPage when set by _toc.chapter[0].topic[0].page[0] is creating an *isolated XML fragment* with no connection to the parent XML object. This differs from how I was working in AS2, where the XMLNode _currentPage behaved like a pointer to the position of the node within the XML object. Is this assumption correct? If so, know any way of getting around it? Would using _currentPage as an XMLNode solve the problem, and if so, is it possible to perform E4X filters/searches on an XMLNode or is it back to XPath for AS3? Jer ___ 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 memory management - loaded content
Can anyone explain the logic for this feature? It seems like an unloadMovie or deleteMovie built in function would be an absolute no-brainer, and even essential. But I say this as a designer-turned-coder so I'm probably missing something that real programmers already know. And I can understand the issues with garbage collection and memory usage, but for the mc to actually keep executing all functions and basically remain in an undead state seems odd. Can someone edumacate me? .m ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - first site
slide.mouseChildren = false; On Mon, Apr 14, 2008 at 11:43 AM, Corban Baxter [EMAIL PROTECTED] wrote: Hey guys I am having some issues with understanding AS3 and how all my scope etc works. Can I get some type of explanation on this. Below is some code I am trying to use in my first AS3 project but I can't seem to get a few things to work out. The problem I see is that since my pictLdr is being put in the slide it inherits the slide's click event. But I don't want the pictLdr to have a click event I just want the slide (container) to have the event. When the pictLdr gets clicked now I am returned with a name value for the pictLdr but I only want the name of the slide since it will have the 'num' var in it and can tell me its position in the slide list. But pictLdr can't. I hope what I am asking makes sense. But I am slightly confused on all this. I understand why pictLdr is getting the event now since its part of the slide and with the new event model this is possible. But with my old AS2 mind I can't work around on how I am supposed to work through this. Please help! Thanks! function createSlides(slides:Array):void { var totalSlides:Number = slides.length; //trace(totalSlides); //create container to hold all the clips for (var i:int = 0; i totalSlides; i++) { //trace(slides[i].num + + slides[i].pages[0]); var slide:SlideContainer = new SlideContainer(); slide.x = 130; slide.y = -180 + (320 * i);//position slide along the y-axis slide.num = i; slide.name = slide + i; slide.buttonMode = true; slide.addEventListener(MouseEvent.CLICK, clicked); container.addChildAt(slide, i);//container for each of the slides and is a MC //this will hold additional info like a background for the images and a holder var pictLdr:Loader = new Loader(); pictLdr.x = 22; pictLdr.y = 19; pictLdr.name = img; slide.addChild(pictLdr);//code works fine if I addChild here. var pictURL:String = gallery/ + slides[i].pages[0];//path to a jpg for the gallery var pictURLReq:URLRequest = new URLRequest(pictURL); pictLdr.load(pictURLReq); pictLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded); } } function clicked(event:MouseEvent):void { trace(event.target.name); //returns img moveSlides(-1); } -- Corban Baxter http://www.projectx4.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] AS3 memory management - loaded content
hi All, Our app is designed to load Flash content examples and widgets from outside servers - anyone on the web can enter a URL.swf into the demo list and those .swf's are loaded as visitors view different areas of the site. Many of the examples we've experimented with setup processes that do NOT let go when the responsible .swf is deleted and/or unloaded from the child container holding it. What's more - even deleting the container does not stop background calculations and sounds from continuing to execute in the player. This is a huge departure from how Flash was! One of the nice features of Flash was the ability to unload content on the fly and know it was out of the player. Is there a reason for this new behavior or just a serious bug - overlooked when the Flash9 player was developed?Dave Matthewshttp://www.2GoTo.com _ Use video conversation to talk face-to-face with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_042008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 memory management - loaded content
Hi Dave, http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html Grant Skinner recently blogged about this. Major issue. What's worse is Adobe really has no intention of fixing it. I believe Grant's blog post was an intention to put mucho pressure on Adobe by exposing how bad the issue is as well as expose how they refuse to fix it. I dunno if it's going to work but it's better than nothing. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 memory management - loaded content
Dave, One thing, though. The documentation states that you absolutely must remove ALL references inside the swf, including timers, enter frame listeners, stop playback of sounds, etc., basically do a complete cleanup, before you can even remove a loaded swf. The issue that Grant brings up is that even if you do all that, it STILL does not release the memory. dave matthews wrote: hi All, Our app is designed to load Flash content examples and widgets from outside servers - anyone on the web can enter a URL.swf into the demo list and those .swf's are loaded as visitors view different areas of the site. Many of the examples we've experimented with setup processes that do NOT let go when the responsible .swf is deleted and/or unloaded from the child container holding it. What's more - even deleting the container does not stop background calculations and sounds from continuing to execute in the player. This is a huge departure from how Flash was! One of the nice features of Flash was the ability to unload content on the fly and know it was out of the player. Is there a reason for this new behavior or just a serious bug - overlooked when the Flash9 player was developed?Dave Matthewshttp://www.2GoTo.com _ Use video conversation to talk face-to-face with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_042008___ 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] deselecting textbox
How easy is it to deselect a textbox when clicking on anything other than the textbox using actionscript? SM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] [AS3] deselecting textbox
Take a look at the FocusManager class. B. On Mon, Apr 7, 2008 at 9:07 AM, Stuart (FunkDaWeb) [EMAIL PROTECTED] wrote: How easy is it to deselect a textbox when clicking on anything other than the textbox using actionscript? 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
Re: [Flashcoders] AS3 MouseEvent target?
so how does it work internally for displayObjects? Can a developer emulate this behaviours somehow?(cant imagine it since target and currentTarget are readonly) On Tue, Apr 1, 2008 at 10:01 PM, Merrill, Jason [EMAIL PROTECTED] wrote: Well, you still haven't convinced me it isn't kludy, but no bother your perspective - my perspective - both different, doesn't matter in the end. :) Jason Merrill Bank of America GTO and Risk LLD Solutions Design Development eTools Multimedia 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 Steven Sacks Sent: Tuesday, April 01, 2008 3:05 PM To: Flash Coders List Subject: Re: [Flashcoders] AS3 MouseEvent target? Extending DisplayObject to access some of its native functionality (e.g. event bubbling) seems fine to me, especially if you look at it from the perspective of EventDispatcher has events and DisplayObject extends EventDispatcher and adds bubbling functionality. If you need bubbling, extend the class that provides that. The whole non-visual argument is a bit of a red herring considering we're using Flash and, until recently, all Actionscript was inside of or attached to a display object (MovieClip). Technically, it still is. ;) Flash is a visual tool, and I maximize my productivity by leveraging it fully. Flash has all kinds of great Flash-centric features and you can definitely use them to your advantage. It's not hacking to use the API given to you. :) ___ 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 -- M.A. van't Kruis http://www.malatze.nl/ ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 MouseEvent target?
which is mouseChildren = false. In my humble opinion I do not think this is what he needs. He should not be referencing target, but instead he should reference currentTarget. If you are adding a listener, the handlers e.currentTarget will point to the object that you added the listener to, e.target is the object that initiated the event (event bubbling). So in a general way, where you in AS2 were using e.target you should now use e.currentTarget. You only use e.target if you want to reference the displayObject that initiated the event. Greetz Erik On 3/31/08, Steven Sacks [EMAIL PROTECTED] wrote: IMO, explaining Event Bubbling as the reason the TextField is the target is complicating the immediate solution he needs, which is mouseChildren = false. Yes, it's Event Bubbling that's causing the target to be the TextField. To understand Event Bubbling, read about it in the docs, or better yet, in a book (like Moock's). But, then you MUST do it yourself to learn how it works. If you don't play with it yourself, you will never get it no matter how much somebody explains it to you. I'm fully convinced of that. You gotta mess around with it to fully understand why it's so amazingly awesome. ___ 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 MouseEvent target?
This behaviour can not emulated precisely because there is no way for us to set the target and currentTarget properties. This is done by internal EventDispatcher code. The EventDispatcher code works something like this: - check if the target property of the event has been set, if not set it - set the currentTarget property - check if the event has the bubbles property set to true - check if the class is a DisplayObject - check if the parent property is set - clone the event and dispatch it at the parent and repeat the above steps Greetz Erik On 4/2/08, Meinte van't Kruis [EMAIL PROTECTED] wrote: so how does it work internally for displayObjects? Can a developer emulate this behaviours somehow?(cant imagine it since target and currentTarget are readonly) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders