Re: [Flashcoders] Can't remove loaded SWF AS3
Cheers Eamonn, I have checked that article already but I couldn't find an answer, I guess I need a more nuts and bolts answer :) Thanks On 7 Nov 2008, at 11:28, Eamonn Faherty wrote: Have you seen? http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html HTH Eamonn -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Alistair Colling Sent: 07 November 2008 11:09 To: Flash Coders List Subject: [Flashcoders] Can't remove loaded SWF AS3 Hi there, I'm aware that if you load a SWF in AS3 it will still exist unless you null it's instance. I'm loading in an external SWF but I can't seem to get rid of it! If anyone can let me know soon I would be super-grateful. Thanks! Here's my code: private function startLoad(s:String):void { try{ mLoader = null; } catch(e:*){ trace(unalble to null loader); } try{ mLoader.unload(); } catch(e:*){ trace(unable to unload as was nulll); } mLoader = new Loader(); mRequest = new URLRequest(s); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); mLoader.load(mRequest); } private function onCompleteHandler(loadEvent:Event):void { loadedSWF = null; trace(loaded); anim.contentLoaded(loadEvent.currentTarget.content); loadedSWF = loadEvent.currentTarget.content; if (urlStr==people.swf){ loadedSWF.x = -345; }else{ loadedSWF.x = -345; } } -- 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 ___ 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
[Flashcoders] Can't remove loaded SWF AS3
Hi there, I'm aware that if you load a SWF in AS3 it will still exist unless you null it's instance. I'm loading in an external SWF but I can't seem to get rid of it! If anyone can let me know soon I would be super-grateful. Thanks! Here's my code: private function startLoad(s:String):void { try{ mLoader = null; } catch(e:*){ trace(unalble to null loader); } try{ mLoader.unload(); } catch(e:*){ trace(unable to unload as was nulll); } mLoader = new Loader(); mRequest = new URLRequest(s); mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler); mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler); mLoader.load(mRequest); } private function onCompleteHandler(loadEvent:Event):void { loadedSWF = null; trace(loaded); anim.contentLoaded(loadEvent.currentTarget.content); loadedSWF = loadEvent.currentTarget.content; if (urlStr==people.swf){ loadedSWF.x = -345; }else{ loadedSWF.x = -345; } } -- 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
[Flashcoders] (Another) quick Delegate question
Hiya, my onLoadProgress / onLoadInit Delegate events won't fire. I've compared this class with other examples and I can't see where I'm going wrong. Any help really really appreciated :) Here's my code: import PreLoader; import Display; import mx.utils.Delegate; class LoadManager { private var rootMC:MovieClip public var loadStatus:LoadStatus; private var preLoader:PreLoader; private var display:Display; private var initLoader:MovieClipLoader; public var initListener:Object; function LoadManager(m:MovieClip, d:Display){ rootMC = m; display = d; init(); } private function init():Void { preLoader = new PreLoader(rootMC); loadInitialAssets(); } private function loadInitialAssets():Void { //create assetsHolder on main timeline var tmpContainer:MovieClip = rootMC.createEmptyMovieClip(assetsHolder, rootMC.getNextHighestDepth()); initLoader = new MovieClipLoader(); initListener = new Object(); initListener.onLoadProgress = Delegate.create(this, onProg); initListener.onLoadInit = Delegate.create(this, onInit); initLoader.addListener(initListener); initLoader.loadClip(assets.swf, tmpContainer); } private function onProg(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { trace(onProg:+target+:+bytesLoaded); } private function onInit():Void { trace(onInit); } } -- 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] Quick Date question, how to add 1 second to Date?
nice one. thanks Keith :) have a great weekend On 22 Aug 2008, at 16:53, Keith Reinfeld wrote: Ali, currTime = new Date(currTime.getTime() + 1000); or currTime.setTime(currTime.getTime() + 1000); Regards, -Keith http://keithreinfeld.home.comcast.net -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Ali Drongo Sent: Friday, August 22, 2008 10:05 AM To: Flash Coders List Subject: [Flashcoders] Quick Date question, how to add 1 second to Date? Hiya, I can't see the wood for the trees with this one. I;m getting an error message of type mismatch when I try and add 1000 onto the date to increase it by 1 second for a timer. I'm sure I am doing something wrong that is patently obvious but I'm not sure what and this is driving me mad! Any help really appreciated, i have to get this working today :) here's my code: public function update():Void { currTime +=1000;// gives Type mismatch in assignment statement: found Number where Date is required. } public function phpLoaded():Void { //receives time since jan 1970 from php var str:String = arguments.caller.lv.toString(); var myA:Array = new Array(); myA = str.split(=) //get computer time trace(servertime:+myA[0]); connectedTime = new Date(); connectedTime += myA[0]; currTime = new Date(); currTime = connectedTime; trace(=+currTime.toString()); clearInterval(secondInterval); update(); secondInterval = setInterval(this, update, 1000); } ___ 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] Buffer flv from midpoint?
Thanks Christoffer I'll check it out. Ali On 24 Jul 2008, at 14:03, Christoffer Enedahl wrote: You need to have a flv streaming service running on a server. Ie Flash Media Server. This is an open source alternative: http://osflash.org/red5. I have not tried it. /Christoffer Ali Drongo skrev: Cheers Paul. that's a help. I've just realised that youtube's video player will buffer your video midway thru a movie, Does anyone know how they do this? Thanks :) Ali On 24 Jul 2008, at 11:47, Paul Jinks wrote: hi Ali I'm working on a similar project, also using progressive download. What I'm doing is using a combination of 2 approaches: 1. Divide the flv into smaller sections - we've gone for 5-8 mins, which is still fairly big I think (otherwise your users are using bandwidth they probably don't need) and 2. Within each clip have section chapter links that load in as they become available. You'll need to use cue points for this. I still haven't worked out the finer points of this approach, mostly because I'm using the chapter links as 'summary' markers also. HTH Paul On Thu, July 24, 2008 11:03 am, Ali Drongo wrote: Hi there, I have to build a video player that plays a video with a number of chapters that the user can skip between. The chapters need to play sequentially also and also. Is there a way can get an flv to buffer from a new chosen point of playback? (i.e. if the user skips to chapter 6 before the whole thing is loaded) If not I guess my best plan is to slice up my long flv into lots of little ones and make a custom seekbar that shows the chapters and allows the user to skip from chapter to chapter. What do yous think? Thanks! Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Check out my website: http://www.pauljinks.co.uk :o) ___ 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 -- 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] Game source code / classes? I need to make a gamequick!
Thanks guys, I'll get the book :) On 15 Jul 2008, at 14:05, Cédric PASCAL wrote: You can also suscribe Lynda.com for a month and watch *ActionScript 3.0 Projects: Game Development*. The level is not very height but maybe it should help you to start. url : http://movielibrary.lynda.com/html/modPage.asp? ID=366loggedin=false Regards Cédric PASCAL 2008/7/15 Kerry Thompson [EMAIL PROTECTED]: Sidney de Koning wrote: There is a realy good book called Actionscript 3 Game University by Gary Rosenzweig. (http://flashgameu.com/) I'll second that. Gary wrote a similar book a few years back for Director, and I learned a lot from his code. I also used a lot of it in Shockwave games for a dot-bomb. With Gary's book's help, I kept my job through three rounds of layoffs. Besides, Gary is a heck of a nice guy. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- PASCAL Cédric étudiant Master 2 Produits et Services Multimédia ___ 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] What's happened to my var?
Thanks Jiri and Hans for your replies both work great though obv Jiris has the shortest syntax. I always trip up not using the Delegate class inside my classes and weird things happen! Thanks again, Ali On 7 Jul 2008, at 17:52, Jiri Heitlager wrote: Or add onCompleteScope:this so you dont need to import Delegate class. TweenFilterLite.to(m, tweenTime, {_y:targetPos, onCompleteScope:this , onComplete:moveShape, onCompleteParams:[_timeline.y1]}); Jiri Ali Drongo wrote: Hi there, I've noticed this happen before and can't figure out why. I have built a simple class that is passed a reference to the timeline. The class then moves an object on the timeline repeatedly using the TweenFilterLite class. My problem is that the second time the moveShape method is called the moveAmt variable is undefined. If anyone can suggest what's going on I would be really thankful! Cheers Ali //Main.as import gs.TweenFilterLite; import utils.Numbers; class Main { var minTime:Number = 1; var maxTime:Number = 2; //number of pixels to move shape up or down var moveAmt:Number = 15; var _timeline:MovieClip; function Main(timeline){ _timeline = timeline; moveShape(_timeline.y1); } //moves a shape up or down private function moveShape(m:MovieClip) { trace(moveShape:+m+ up:+m.up); var moveDir:Number = 1; //if movieclip is tagged as moving up if(m.up){ moveDir = -1; m.up= false; }else{ m.up=true; } var targetPos:Number = moveDir*moveAmt; trace(moveDir:+moveDir); trace(moveAmt:+moveAmt); trace(target:+targetPos); var tweenTime:Number = Numbers.randRange(minTime, maxTime); TweenFilterLite.to(m, tweenTime, {_y:targetPos, onComplete:moveShape, onCompleteParams:[_timeline.y1]}); } } ___ 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] How to add bitmaps from my library to the stage AS3?
Thanks Jonathon and Eduardo for your answers, I'll get them implemented. :) Ali On 19 Jun 2008, at 15:29, Eduardo Omine wrote: IIRC, because your LibImage extends BitmapData, it needs the 2 parameters required by the BitmapData constructor (width and height). var formatImg = new LibImage(10, 10); http://www.kirupa.com/forum/showthread.php?p=2113725 -- Eduardo Omine http://blog.omine.net/ http://www.omine.net/ ___ 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] Insert breakpoints and run debugger withoutFlashCS3?
can the admins not block him? On 16 Jun 2008, at 10:11, Viktor Hesselbom wrote: And everytime he replies back with his auto-replyer he gets a new message back to him and in continues in an evil loop. That's my guess, anyway. / Viktor H On Mon, 16 Jun 2008 10:48:56 +0200, Geografiek [EMAIL PROTECTED] wrote: I'm afraid so, it seems to be multipying even ;-) Willem Op 16-jun-2008, om 10:40 heeft Ali Drongo het volgende geschreven: Do you think it'll send every time there's a flashcoders post? On 16 Jun 2008, at 09:35, Ian Thomas wrote: I'm guessing it's an away/vacation message. Ian 2008/6/16 Ali Drongo [EMAIL PROTECTED]: Any chance of a translation? :) On 16 Jun 2008, at 09:20, EDELSTAR wrote: Данный почтовый ящик не обрабатывает подгрузки, заявки и прочие сообщения. Вам нужно написать на адрес, присвоенный Вашему СПО. ___ 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 -- 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 -- 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] Insert breakpoints and run debugger withoutFlashCS3?
Maybe if someone answered my question it would stop? ;) On 16 Jun 2008, at 10:16, Vlado Krempl wrote: This is getting slightly anoying isn't it! Vlado Krempl Sydney, Australia On 16/06/2008, at 6:49 PM, EDELSTAR wrote: Данный почтовый ящик не обрабатывает подгрузки, заявки и прочие сообщения. Вам нужно написать на адрес, присвоенный Вашему СПО. ___ 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
[Flashcoders] Insert breakpoints and run debugger without Flash CS3?
Hiya, is there a way I can add breakpoints to my code and execute it block by block now I am not using the Flash IDE? Thanks, Alistair -- 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: 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
[Flashcoders] Linked sounds in library have to be in root SWF? AS2
Hi there thanks for reading my post. I've been working on a project that has a bunch of sounds in the library that have linkage identifiers. I have classes that target these sounds and these are instantiated in the main movie clip. Now I have made a loader for the main movie clip the sounds don't play :( The only way I can get them to work is to rewrite how I load my sounds (externally or streaming) or to put them into the loader.swf's library (which kind of defeats the point of a loader if it is 500k :P) I'm guessing there is an easy way around this. Does anyone know of one? Thanks for your assistance in advance :) Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Linked sounds in library have to be in root SWF? AS2
Cheers Rich, I had to get this project finished for a deadline so I've gone through and converted my aifs to mp3s and am loading these in at the start. Thanks for your reply though, I'll remember this next time (or maybe try and use all external resources so everyhthing is more flexible). Cheers tho :) Ali On 12 May 2008, at 19:45, Rich Shupe wrote: Alistair, From what I can gather from your email, try this. When you are creating your sound instances, add this to the constructor. = new Sound(this); That will specify that the sound comes from the loaded file. 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] Why isn't my TextField multiline? AS2
Thanks for your reply Chistoffer, I'm afraid it's still not working, the characters appear in my text field. Here's the code I am using to create the text format and textfield, maybe something here is screwing it up: var myM:TextFormat = new TextFormat(); myM.align = center; myM.font = Serifa Blk BT; myM.size = 20; myM.color = 0x00; myM.leading = -5; myM.letterSpacing = -1; //add text to boxes var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.wordWrap = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); Any suggestions flashers? On 8 May 2008, at 10:06, Christoffer Enedahl wrote: Try \n or \r\n HTH/Christoffer Alistair Colling skrev: Thanks guys :) works perfectly. Now it seems my line returns (\r) aren't being recognised (they show up in the textfield). Anyone got any ideas whats going on? Cheers On 7 May 2008, at 18:19, Robert Leisle wrote: Hi Alistair, Try adding this to your code: tmpField.wordWrap = true; Hth, Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alistair Colling Sent: Wednesday, May 07, 2008 10:03 AM To: Flash Coders List Subject: [Flashcoders] Why isn't my TextField multiline? AS2 Hi there, thanks for checking this. I'm generating a textfield from within a custom class but I can't seem to make it multiline, I can see the border of the textfield is the right size my text only appears on the first line and also my carriage returns \r are having no effect. I've tried a number of options for properties of the textfield but I cant seem to get it to work. Any suggestions thankfully received this is taking lots of time for a simple thing! Cheers, Ali Here's the code from within my class: var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Why isn't my TextField multiline? AS2
Thanks for your reply Chistoffer, I'm afraid it's still not working, the characters appear in my text field. Here's the code I am using to create the text format and textfield, maybe something here is screwing it up: var myM:TextFormat = new TextFormat(); myM.align = center; myM.font = Serifa Blk BT; myM.size = 20; myM.color = 0x00; myM.leading = -5; myM.letterSpacing = -1; //add text to boxes var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.wordWrap = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); Any suggestions flashers? On 8 May 2008, at 10:06, Christoffer Enedahl wrote: Try \n or \r\n HTH/Christoffer Alistair Colling skrev: Thanks guys :) works perfectly. Now it seems my line returns (\r) aren't being recognised (they show up in the textfield). Anyone got any ideas whats going on? Cheers On 7 May 2008, at 18:19, Robert Leisle wrote: Hi Alistair, Try adding this to your code: tmpField.wordWrap = true; Hth, Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alistair Colling Sent: Wednesday, May 07, 2008 10:03 AM To: Flash Coders List Subject: [Flashcoders] Why isn't my TextField multiline? AS2 Hi there, thanks for checking this. I'm generating a textfield from within a custom class but I can't seem to make it multiline, I can see the border of the textfield is the right size my text only appears on the first line and also my carriage returns \r are having no effect. I've tried a number of options for properties of the textfield but I cant seem to get it to work. Any suggestions thankfully received this is taking lots of time for a simple thing! Cheers, Ali Here's the code from within my class: var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); ___ 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 -- 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] Why isn't my TextField multiline? AS2
Thanks guys :) works perfectly. Now it seems my line returns (\r) aren't being recognised (they show up in the textfield). Anyone got any ideas whats going on? Cheers On 7 May 2008, at 18:19, Robert Leisle wrote: Hi Alistair, Try adding this to your code: tmpField.wordWrap = true; Hth, Bob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alistair Colling Sent: Wednesday, May 07, 2008 10:03 AM To: Flash Coders List Subject: [Flashcoders] Why isn't my TextField multiline? AS2 Hi there, thanks for checking this. I'm generating a textfield from within a custom class but I can't seem to make it multiline, I can see the border of the textfield is the right size my text only appears on the first line and also my carriage returns \r are having no effect. I've tried a number of options for properties of the textfield but I cant seem to get it to work. Any suggestions thankfully received this is taking lots of time for a simple thing! Cheers, Ali Here's the code from within my class: var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); ___ 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] Why isn't my TextField multiline? AS2
hmm, the string that is being targeted is held in a variable that is set from an xml file so should just be a regular string, i'll look into this tho. Thanks Rich On 8 May 2008, at 13:38, Rich Shupe wrote: I think the problem is that you're pulling your string from another text field. In that case, the characters are just characters, rather than control codes. This subset of your code works fine: var tmpField:TextField = this.createTextField(my_txt, 1, 0,0,100,100); tmpField.selectable = false; tmpField.border = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.wordWrap = true; tmpField.text = test\rtest; However, putting test\rtest in another text field, and then saying this: tmpField.text = other.text; shows the characters. If you have to pull text from another field, try using HTML and setting the .html of one field to the .html of another field. Rich http://www.LearningActionScript3.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Why isn't my TextField multiline? AS2
Hi there, thanks for checking this. I'm generating a textfield from within a custom class but I can't seem to make it multiline, I can see the border of the textfield is the right size my text only appears on the first line and also my carriage returns \r are having no effect. I've tried a number of options for properties of the textfield but I cant seem to get it to work. Any suggestions thankfully received this is taking lots of time for a simple thing! Cheers, Ali Here's the code from within my class: var oline:MovieClip = mainMC.monkey.bubble.outline var tmpBox:MovieClip = mainMC.monkey.bubble.createEmptyMovieClip (text_mc, 1); var tmpField:TextField = tmpBox.createTextField(my_txt, 1, oline._x, oline._y, oline._width, oline._height); tmpField.selectable = false; tmpField.border = true; tmpField.embedFonts = true; tmpField.type = dynamic; tmpField.multiline = true; tmpField.text = Q.monkeyStr; tmpField.setTextFormat(myM); ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How do I remove methods of superclass in AS2?
Hiya, thanks for checking this. I have a custom class that I am using as kind of button. The thing is I now want to remove the onPress and onRelease methods as there is a nested movieclip I want to attach these events to. What I would like to know is can I remove or nullify the methods of a superclass from the subclass? Any help very much appreciated, an outline of my code is below. Thanks :) Ali // superclass class Classes.AnswerBut extends MovieClip{ function AnswerBut(){ trace(AnswerBut created); } public function onPress(){ //actions here } public function onRelease(){ //actions here } } //subclass class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){ trace(NoAnswerBut created); } // I want to remove the onPress / onRelease events in the class definition here } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] How do I remove methods of superclass in AS2?
Thanks for your responses guys, I have removed onPress/onRelease events as you suggested onPress = undefined ; onRelease = undefined ; delete(onPress); delete(onRelease); but now my nested mc will not fire any mouse events, I am guessing that these mouse events have been removed for any nested clips in that mc too. I've un-nested my movie clip to solve the problem and it all works fine. Your help is appreciated :) Ali On 1 May 2008, at 12:44, Karim Beyrouti wrote: How about: class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){trace(NoAnswerBut created);} public function onPress(){}//no actions here public function onRelease(){}//no actions here } Another option is to override the actions. Otherwise if you want to get rid of the mouse events you could do this: class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){ trace(NoAnswerBut created); onPress = undefined ; onRelease = undefined ; delete(onPress); delete(onRelease); } } However, I recommend this one: // superclass class Classes.AnswerBut extends MovieClip{ function AnswerBut(){ trace(AnswerBut created); onPress = _onPress onRelease = _onRelease } public function _onPress(){ //actions here } public function _onRelease(){ //actions here } } //subclass class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){ trace(NoAnswerBut created); // not sure if you even need to do this: // as long as you don't call super(); onPress = undefined ; onRelease = undefined ; delete(onPress); delete(onRelease); } } Hope this helps... Karim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alistair Colling Sent: 01 May 2008 12:21 To: Flash Coders List Subject: [Flashcoders] How do I remove methods of superclass in AS2? Hiya, thanks for checking this. I have a custom class that I am using as kind of button. The thing is I now want to remove the onPress and onRelease methods as there is a nested movieclip I want to attach these events to. What I would like to know is can I remove or nullify the methods of a superclass from the subclass? Any help very much appreciated, an outline of my code is below. Thanks :) Ali // superclass class Classes.AnswerBut extends MovieClip{ function AnswerBut(){ trace(AnswerBut created); } public function onPress(){ //actions here } public function onRelease(){ //actions here } } //subclass class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){ trace(NoAnswerBut created); } // I want to remove the onPress / onRelease events in the class definition here } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date: 30/04/2008 18:10 ___ 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
Re: [Flashcoders] How do I remove methods of superclass in AS2?
Thanks for your responses guys, I have removed onPress/onRelease events as you suggested onPress = undefined ; onRelease = undefined ; delete(onPress); delete(onRelease); but now my nested mc will not fire any mouse events, I am guessing that these mouse events have been removed for any nested clips in that mc too. I've un-nested my movie clip to solve the problem and it all works fine. Your help is appreciated :) Ali On 1 May 2008, at 12:46, Cor wrote: You can with override -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Alistair Colling Verzonden: donderdag 1 mei 2008 13:21 Aan: Flash Coders List Onderwerp: [Flashcoders] How do I remove methods of superclass in AS2? Hiya, thanks for checking this. I have a custom class that I am using as kind of button. The thing is I now want to remove the onPress and onRelease methods as there is a nested movieclip I want to attach these events to. What I would like to know is can I remove or nullify the methods of a superclass from the subclass? Any help very much appreciated, an outline of my code is below. Thanks :) Ali // superclass class Classes.AnswerBut extends MovieClip{ function AnswerBut(){ trace(AnswerBut created); } public function onPress(){ //actions here } public function onRelease(){ //actions here } } //subclass class Classes.NoAnswerBut extends Classes.AnswerBut{ function NoAnswerBut(){ trace(NoAnswerBut created); } // I want to remove the onPress / onRelease events in the class definition here } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG. Version: 8.0.100 / Virus Database: 269.23.7/1408 - Release Date: 4/30/2008 6:10 PM ___ 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] How does 'Compress movie' publish setting work?
Just out of interest really :) And why would you switch it off? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Variables can only be seen from outside of class
Hi there, this is a weird problem that I am sure has a really simple solution. I have written a custom class that is instantiated by another custom class. I pass a few variables to the class and I can trace them going in and check that they are set but when I go to use them again they are undefined, if I trace them from the class they are undefined. However, if I trace the variables from the main timeline they appear fine. I'm not sure what is going on with this, I think I am declaring my class or variables incorrectly though i can't see where. I have been battling with this since yesterday, if anyone could suggest a possible solution it would be a massive help. The class is at the bottom of the email. Thanks, Ali // // AnimLib // import gs.TweenFilterLite; import quest.StepAnimator; import mx.utils.Delegate; class Classes.AnimLib{ var anims_ar:Array; var mainMC:MovieClip; //animation abjects/times var genericTime:Number = 0.5; public var sA:StepAnimator; var genericIn:Object; var genericOut:Object; var mcO:MovieClip; //individual animation objects var umbrellaIn:Object = {autoAlpha:50, overwrite:true, time:5}; public function AnimLib(m:MovieClip, s:StepAnimator) { trace(animLib created); mainMC = m; trace(step animator passed:+s); sA = s; trace(step animator set:+sA); initObs(); linkAnims(); trace(starting tween); } private function initObs() { genericIn = new Object(); trace(GENERICIN CREATED:+genericIn); genericOut = new Object(); genericIn = {autoAlpha:100, overwrite:true, time:1}; genericOut = {autoAlpha:0, overwrite:true, time:0.5}; trace(genericIn properties added:+genericIn); trace(init obs triggers test); } //only holds references for objects that have a group or a function assigned to them (more comple) private function linkAnims() { //this[0] = {mc:escapes, group:generic}; //this[0] = {mc:escapes, group:generic}; anims_ar = new Array(); anims_ar[0] = {mc:intro, fn:intro}; } public function animDone() { trace(mainMC:+mainMC); sA.animDone(); //_root.stepA.animDone(); this.sA.animDone(); } function testIt() { trace(testest :):):):):)); } //introduction animation public function introAnim(m:MovieClip, b:Boolean) { trace(! ! ! ! ! -introAnim triggered:+m+b); genericIn = {autoAlpha:100, overwrite:true, time:1}; genericOut = {autoAlpha:0, overwrite:true, time:0.1}; m = mainMC.intro; m._alpha = 100; //create array of mcs then add delay thru loop, var mc_ar:Array = new Array(m.sitePhoto, m.topTitle, m.title, m.escapes, m.ans0, m.ans1); var alph:Number = 100 if (!b) { alph = 0; } trace(intro vis:+_root.intro._visible+ alpha:+_root.intro._alpha + alph:+alph); //TweenFilterLite for ( var i=0; imc_ar.length; i++ ) { if (i==mc_ar.length-1) { TweenFilterLite.to(mc_ar[i], 1,{_alpha:alph, overwrite:true, delay:.5*i, onComplete:animDone}); }else{ TweenFilterLite.to(mc_ar[i], 1,{_alpha:alph, overwrite:true, delay:.5*i}); } }; } //custom test function where more than one animation has to happen function escapeFun(m:MovieClip, inO:Boolean) { trace(escapefuncalled:+m); //assigns generic obj var tmpObj:Object = genericIn; //then modifies it tmpObj.time = 2; //m._visible = true; TweenFilterLite.to(m,1,{autoAlpha:100}); } //is passed a mc and animates it in or out public function animate(m:MovieClip, i:Boolean) { var animObj:Object = returnAnimObj(m, i); trace(returned object:+animObj); //animate if (animObj.undefined == 1) { trace(UNDEFINED ANIM OBJECT RETURNED (fn/group?)); // intro(); } else { trace(animating...); TweenFilterLite.to(m,animObj.time,animObj); } } private function returnAnimObj(mc:MovieClip, ins:Boolean):Object { trace(returnAnimObj:+mc); var inStr:String
[Flashcoders] Image colorization / contrast adjusting
Hello, I would like to know if it is possible for flash to process a regular photograph to produce a pop-arty image like this: http://www.popartuk.com/g/l/lgpo7028+pop-art-andy-warhol-1962-che- guevara-poster.jpg The user would upload their photograph, I guess I would then need flash to convert it to black and white add some sort of severe contrast so I get 3 distinct colours and then separate these sections so I can colour them with bright colours. I am not sure if this is possible or the best way to go about this. If someone could let me know if this would be possible to do and maybe give me some direction as to how to do it that would be great. Many thanks, Alistair ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How to delegate function call in Boostyworthy AS2
Hiya, I'm sure you guessed from the title this query is specific to the Boostworthy AS2 animation system. I've been on with this for a little while, if someone could give me a quick heads-up that would be great. I want to call a function at a certain point in my virtual timeline, I'm guessing I have to use the custom Delegate Method supplied but I don't know how to add it to the virtual timeline. The AS3 code looks like this: myTimeline.addTween(new Action(finalAnimDone, [], undefined, undefined, 20)); Has anyone managed to achieve the same with the AS2 version? Cheers Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Solved- Re: Dynamically created gradient fill doesn't mask like a gradient
I have it, hope this is helpful to someone, you need to publish to FP 8 and enable the cacheAsBitmap property of the masker and maskee. http://www.whatdoiknow.org/archives/002407.shtml Thanks, Ali On 19 Feb 2008, at 11:44, Alistair Colling wrote: Hiya, I think the title sums this up pretty well. I have dynamically created a box that is filled with a gradient where one of the colour's alphas is 100 and the other is 0, I have made the ratios 0, 255 and have made sure the matrix box is the same dimensions and xy placement as the box I am drawing. I want to set the dynamically created gradient box as a mask so I can have a nice gradient mask though when I set this I get the mask as if the box is a solid fill. I have checked without using setMask () and the box looks as it should. If anyone has successfully drawn a gradient fill and used it as a mask I would be really interested to see the code as I can't figure out why this isn't working. Thanks in advance for any advice, suggestions or encouragement, Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Control speed by how fast mouse moving
Hiya, how about logging the _root._xmouse properties (AS2) or log the localX/ stageX properties of the MouseEvent class in AS3. The timer can be triggered by moving over a movieclip or by whatever then set the parameters of where your 'moving area' is to be on the stage or let the user use the whole stage once the timer starts, using this method you can log their movements outside of the box! Hope this helps, Ali On 13 Feb 2008, at 07:04, Paul Steven wrote: Thanks Cory Good point about the setInterval introducing redundant processing.Problem with placing an invisible movie clip is, the users mouse may not pass over this movie clip. For example, the movie is 600 pixels wide and 400 pixels high. If I place a 400 high and say 10 pixels wide movie clip in the center of the movie, it is still possible for the player to move their mouse left and right in the area to the left or the area to the right of the hidden movie clip - hence no speed would be detected. I am therefore not sure how to overcome this apart from insisting they move the mouse in a specified area. Any ideas anyone? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cory Petosky Sent: 12 February 2008 21:52 To: Flash Coders List Cc: [EMAIL PROTECTED] Subject: Re: [Flashcoders] Control speed by how fast mouse moving You'd be better off doing it in an onEnterFrame or a onMouseMove than in a setInterval call -- code is only executed between frames anyway, so your way just adds extra processing burden. Since all these events are only working once per frame, just comparing x's isn't likely to give you meaningful data -- if a player moves his mouse rapidly left to right at a rate that's some factor of your framerate, you could easily get the same (or similar) x value at every read. Increasing the framerate could help this, but brings other problems. Consider placing a small, invisible movieclip on the path you intend the user to move his mouse, and listen for onRollOver. You can use the number of RollOver events per second to adjust speed. Just keep in mind that you won't get any more events than your framerate. Finally, instead of adjusting speed directly, adjust max speed and provide a constant acceleration toward the current max speed. For example, if the user starts out at a rate that correlates to 50 mph, his current speed should slowly increase at a constant rate over many seconds until it reaches 50. Similarly, once the user begins to slow down, the speed should decrease linearly to the maximum speed allowed by the mouse move rate. This provides a slow acceleration at the beginning -- which is probably what you want if you're emulating the old button mashers -- and provides smooth speed changes as the game progresses, which is definitely good. On 2/12/08, Paul Steven [EMAIL PROTECTED] wrote: I am trying to program a game where a character moves faster, the faster the player moved the mouse left and right. A bit like the old Dailey Decathlon Game where you had to hit 2 keys on the keyboard on after the other as fast as you can to control the speed of say a character running. I could do with some advice on how to achieve this. I have a frame rate of 31 FPS, with a movie width of 600 pixels. Currently I am calling a function every 10ms to calculate the speed objShowerGame.updateSpeedInterval = setInterval(updateSpeed, 10); I compare the previous mouse X position with the current one and use this difference as the speed. This isn't really working so I could do with some suggestions. Thanks Paul ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Cory Petosky : Lead Developer : PUNY 1618 Central Ave NE Suite 130 Minneapolis, MN 55413 Office: 612.216.3924 Mobile: 240.422.9652 Fax: 612.605.9216 http://www.punyentertainment.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 mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Anyone know of music sequencer source code?
Hiya, I'm looking into working on a project where a simple music sequencer is created. Does anyone know of any pre-existing classes or FLAs that do this, I have come across popforge, are there any others? Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Multiple moviecliploaders
I've written a simple class that loads multiple objects and triggers a function when all have downloaded. If you needed to trigger multiple sets of objects loading you could just create a new instance of the class. You need the loadObj class also. Hope this help Ali // // LoadChecker // this class is passed am array and calls a function when all of the objects in the array are loaded // // Created by Alistair Colling on 2008-01-30. // // pass mcs to load and start loading // FLA CODE // import mc.LoadObj // // import mc.LoadChecker // function completed(){ } // function percentLoad(pc:Number){}; // this.createEmptyMovieClip(loader, 1); // var ob1:LoadObj = new LoadObj(Content/roseAnim.swf, loader); // var load_ar:Array = [ob1] // var myLoader:LoadChecker = new LoadChecker(load_ar, completed, percentLoad); // // // import mc.*; import mx.utils.Delegate; // class mc.LoadChecker { private var allLoadedFn:Function; private var progFn:Function; public var itemsToLoad_ar:Array; private var itemsLoaded:Array; //total Bytes to load of all objects passed private var totalBytes:Number; private var totalLoaded:Number; public function LoadChecker(a:Array, f:Function, pF:Function) { trace(loadchecker! created:+a.toString()); totalBytes = 0; totalLoaded = 0; allLoadedFn = f; progFn = pF; itemsLoaded = new Array(); itemsToLoad_ar = a; for (var i = 0; iitemsToLoad_ar.length; i++) { var arRef:Number = i; var tempLoad:LoadObj = itemsToLoad_ar[arRef]; //array contains custom objects taht contain url and mc vars myLoader(tempLoad.targURL,tempLoad.targMC); } } private function myLoader(str:String, mc:MovieClip) { // trace(MY LOADER loading file:+str+ mc:+mc); var loadListener = new Object(); loadListener.onLoadInit = Delegate.create(this, mcLoaded); loadListener.onLoadProgress = Delegate.create(this, loadProgress); var mcLoader = new MovieClipLoader(); mcLoader.addListener(loadListener); //create holder inside of movie clip--remove this when finished lenor!! //var holder:MovieClip = mc.createEmptyMovieClip(holder, mc.getNextHighestDepth()); mcLoader.loadClip(str, mc); } //returns pos of mc in array private function mcInAr(mc:MovieClip, ar:Array):Number{ var retNum:Number = undefined; for (var i=0; iar.length; i++){ //trace(--CHECKING MC:+mc+ arrray MC:+ar[i].targMC); if (mc == ar[i].targMC){ retNum = i; } } return retNum; } private function loadProgress(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void { var posInAr:Number = mcInAr(target, itemsToLoad_ar); //add totalBytes up when first progress comes thru for each object //trace(load progress mc+target+ total bytes:+bytesTotal+ so far+bytesLoaded); if (itemsToLoad_ar[posInAr].totalBytes==undefined){ itemsToLoad_ar[posInAr].totalBytes = bytesTotal; totalBytes += bytesTotal; // trace(TOTAL BYTES UPDATED TO:+totalBytes); } itemsToLoad_ar[posInAr].bytesLoaded = bytesLoaded; ///update total bytes loaded-- could think of a better way to code this so it doesnt reset to 0 totalLoaded = 0; for ( var i=0; iitemsToLoad_ar.length; i++ ) { totalLoaded+= itemsToLoad_ar[i].bytesLoaded; }; // trace(total bytes loaded now:+totalLoaded); calcPercent() //calculate total % bytes loaded } //triggers function that shows total percentage loaded-- could be extended to return an array of values to show individual fiels loading status private function calcPercent() { var pcLoaded:Number = Math.round((totalLoaded/totalBytes)*100); // trace(--- Total PERCENT NOW LOADED:+pcLoaded); progFn(pcLoaded); } private function mcLoaded(mcl:MovieClip
Re: [Flashcoders] Anyone know of music sequencer source code?
Thanks for the links Glen, these all seem to be for synthesizers and I can't seem to find the source code for the sequencers that trigger them to play, a simple music sequencer shouldn't be so hard to write, I'm just guessing that there's audio syncing issues I'll probably run into that have already been solved. Cheers Ali On 13 Feb 2008, at 11:37, Glen Pike wrote: Look at Flash Coders Brighton's synth project http://www.flashbrighton.org/wordpress/?p=9 And Andre-Michelle's work too: http://blog.andre-michelle.com/2006/how-cool-is-audioprogramming/ These guys have done lots of audio programming for Flash, so read around those articles. Alex Issac wrote a MIDI plugin for Flash that you can install as an optional extra, think there are some sequencing classes in here. http://www.alexisisaac.net/products/flashMidi/ HTH Glen Alistair Colling wrote: Hiya, I'm looking into working on a project where a simple music sequencer is created. Does anyone know of any pre-existing classes or FLAs that do this, I have come across popforge, are there any others? Thanks Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01736 759321 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] Dynamically animating writing effect
Thanks for the suggestion Erik, I've done a bit of research into these classes and they are very interesting but it seems I am still left with the same problem of figuring out how each character would appear when written as this information isn't in the font data. I'm not sure there is a logical answer to my problem that can be coded, even if the characters' pixels fill out from a certain point the application would still need to know which way the stroke should go on letters with repeating strokes and loops like d's. I guess this one would have to be animated by hand for each of the individual characters of a certain font and then drawn dynamically, triggering each letter to be drawn sequentially and maybe also somehow returning a reference for the pen nib. Cheers Ali On 10 Feb 2008, at 11:13, EECOLOR wrote: Whow, tough task... If I were given that assignment I would check out this application: http://www.sephiroth.it/file_detail.php?id=159# It allows you to read font information. This font information allows you to draw the font using information available in the font file itself. If I am correct the application draws the font using an included graphics library. If you end up using this for your application I would recommend you to consider to donate something using the paypal button on that page. Greetz Erik On 2/10/08, ali drongo [EMAIL PROTECTED] wrote: Hiya, I am wanting to create an effect where text will appear on the screen as if it is being written by a pen. I am going to set about writing a class to achieve this and wanted to get the group's thoughts on if I am going about this the right way. My idea is that I could create all of my text in textfield then convert the textfield somehow into a BitmapData object, then I could use the BitmapData class to scan through the image starting at the top left and figure out which pixels are coloured by the text and then I duplicate the BitmapData object and colour the pixels gradually. My class would need to know which angle the text should be appearing (writing) in. The font I use would have to use 'joined up' writing also obv. Does anyone think this would work or is there a simple way to achieve what I am looking to do? Thanks, 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] Anyone know of good mac app that will trace outside of Flash
Thanks everyone for your responses. Alcon is just what I'm looking for, I'll have a look into XRay as I think it may be useful for larger projects but for day to day Alcon is great and now I can make all of my text colours beautiful in Textmate and Alcon my quality of life has improved. My next problem is to see if I can get my as2 flas to compile from Textmate and then open flash player with Alcon to debug. Better get off to the Textmate list. Cheers guys, have a good weekend On 7 Feb 2008, at 15:26, Andy Herrman wrote: I've been using Alcon: http://osflash.org/projects/alcon It's lighter weight and much simpler than xray and has been quite useful. You can run it from the provided exe or from the SWF. The SWF should work fine on the Mac. -Andy On Feb 7, 2008 7:07 AM, Sidney de Koning [EMAIL PROTECTED] wrote: Hi Ali, I use XRAY from Blitz (http://osflash.org/xray) its is a very good debug / logger tool. and it just uses a SWF that you run. Cheers, Sid Alistair Colling wrote: Oops, sorry pressed send too quick on that one, here's the complete message Hiya, I have been using XTrace (http://mabblog.com/xtrace.html) and it is a great application as it allows me to view my trace messages with different colours outside of the Flash IDE. My problem is that after a short while the window disappears so I can't reference my trace messages while I edit my code in Textmate. Does anyone know of another tracing app that would float above all apps as XTrace does and woul allow me to look over trace messages in this way? 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Alistair Colling Interactive Developer FPP Design Limited (Newcastle upon Tyne) The Courtyard Dinsdale Place Sandyford Newcastle upon Tyne NE2 1BD Telephone: +44 (0)191 261 6662 Fax: +44 (0)191 233 0609 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
[Flashcoders] Anyone know of good mac app that will trace outside of Flash
Oops, sorry pressed send too quick on that one, here's the complete message Hiya, I have been using XTrace (http://mabblog.com/xtrace.html) and it is a great application as it allows me to view my trace messages with different colours outside of the Flash IDE. My problem is that after a short while the window disappears so I can't reference my trace messages while I edit my code in Textmate. Does anyone know of another tracing app that would float above all apps as XTrace does and woul allow me to look over trace messages in this way? Cheers! Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS2 Delegate event won't fire in my multi swf load class
Thanks for your quick reply Glen, thing is, I want to allow the class to trigger different functions that are passed to it and also to monitor the progress of a number of SWFs. Sorry if I'm missing something here. Cheers, Ali On 31 Jan 2008, at 10:55, Glen Pike wrote: Hi, Why don't you just make your class the listener for the MovieClipLoader and then implement the functions in your class? class LoadChecker { var mcLoader:MovieClipLoader; function LoadChecker() { mcLoader = new MovieClipLoader(); mcLoader.addListener(this); } function myLoader(str, mc) { //... mcLoader.loadClip(str, mc); } function onLoadInit(mc...) { trace(loaded mc + mc) ; //...doStuff. mcLoaded(mc); } function onLoadError(mc...) { trace(oops, there was an error ); //...carry on? } function mcLoaded(mc) { //... } } Put a trace in your onLoadInit function and also implement the onLoadError function for the listener so you can see if they are called - you can also stub out the other functions for MovieClipLoader listeners and put traces in those to make sure it starts loading, etc. HTH Glen ali drongo wrote: Hiya, I've written a class that will load multiple SWFs and then call a passed function when complete. My problem is that when all the movies have downloaded the passed function won't fire. If anyone could help me figure this that would be really helpful.Cheers, Ali // // LoadChecker // this class is passed am array and calls a function when all of the objects in the array are loaded // // Created by Alistair Colling on 2008-01-30. // Copyright FPP Design Ltd 2008. All rights reserved. // // pass mcs to load and start loading import mc.*; import mx.utils.Delegate; class mc.LoadChecker { private var allLoadedFn:Function; public var itemsToLoad_ar:Array; private var itemsLoaded:Array; public function LoadChecker(a:Array, f:Function) { trace(loadchecker! created:+a.toString()); allLoadedFn = f; itemsLoaded = new Array(); itemsToLoad_ar = a; for (var i = 0; iitemsToLoad_ar.length; i++) { var arRef:Number = i; var tempLoad:LoadObj = itemsToLoad_ar[arRef]; myLoader(tempLoad.targURL,tempLoad.targMC); } } function myLoader(str, mc) { trace(MY LOADER loading file:+str+ mc:+mc); var loadListener:Object = new Object(); var tmpFun:Function = mcLoaded; loadListener.onLoadInit = function(target_mc:MovieClip):Void { tmpFun.apply(null, [target_mc]); }; var mcLoader:MovieClipLoader = new MovieClipLoader(); mcLoader.addListener(loadListener); //create holder inside of movie clip var holder:MovieClip = mc.createEmptyMovieClip(holder, mc.getNextHighestDepth()); mcLoader.loadClip(str,holder); } function mcLoaded(mcl:MovieClip) { trace(a movie is loaded:+mcl); itemsLoaded.push(mcl); if(itemsLoaded.length==itemsToLoad_ar.length){ trace(all movies are now loaded); allLoadedFn.apply(null); } } } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- Glen Pike 01736 759321 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] Problems loading AS2 into AS2 then into AS3 holder
Hi there, I have an AS3 movie in to which I load as AS2 movie, this works great. My problem starts when I then load another AS2 movie into the first AS2 movie. I am using MovieClipLoader and although the swf I am loading loads (I have put a trace on its timeline so I know it's there), the onLoadComplete/onLoadInit events do not fire! If anyone could let me now if this is a known problem or if there is a way around this I would be really grateful, I can call a function from my loaded movie's timeline but this is soon going to get very messy as the app is quite complex. Any suggestions, advice or simply encouragement much appreciated otherwise I'm going to have to convert my AS3 app back into old AS2 :( Cheers Alistair ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Short syntax for accessing nested display objects? (AS3)
Hiya everyone, good to see the list back up and running. I'm trying to access a sprite that is inside of 2 other sprites and I have 2 questions about this: 1) It seems that the syntax for targeting this sprite once it is created is quite long winded (2 temporary vars have to be created): var cont:Sprite = new Sprite(); this.addChild(cont); var cont1:Sprite = new Sprite(); cont.addChild(cont1); var child1:Sprite = new H1(); var target =cont.getChildByName(cont1); var targ2 = target.getChildByName(child1); targ2._visible = false; 2) Also, I can't data type my target var as a Sprite otherwise I get an error (unless I cast the type as well). If anyone knows of a better of doing this I would be really interested to hear it :) Cheers, Ali ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] How to share class library across a network?
Hi there, I would like to share my class library with other developers on my local network. We are soon to be using Version Cue or something similar but in the meantime it would be good if we could al be working from the same class library (there are only 2 of us). Almost every time we exchange a file lots of compiler errors are thrown up even though the class paths are set correctly, this is usually rectified after restarting the computer or Flash. I have copied my class library to a network share but when I compile a SWF from Flash I get lots of compiler errors starting with line 6 of toplevel.as 'The class or interface 'Boolean' could not be loaded' 'The class or interface 'Object' could not be loaded' 'The class or interface 'Number' could not be loaded' If I point my class path (set in my AS preferences for the Flash app) to an exact copy of the same folder but on my local drive everything works fine! If someone could help me out here I would be really grateful, this is proving a real headache! Cheers, Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Class to loop sound objects in order
Thanks Muzak for your solution I think it will be the simplest to implement I'll check out your class also Alan, I guess I could create the array dynamically quite easily rather than having to hard-code the values. Thanks for your super-quick responses guys :) Dan On 15 Aug 2007, at 12:52, Alain Rousseau wrote: you can check out these set of classes I created for something similar to what you need. it doesn't loop each mp3 files but, creates a song based on an array of mp3 files . You can modify it as you wish to fit your needs but the simplest thing would be to just to repeat the filename in the array [file1, file1, file1, file2, file3, ... ] http://lab.daroost.ca/2007/02/25/sondloop2-revisited-musicbuilder- soundobject/ HTH Alain [EMAIL PROTECTED] wrote: Hi there, thanks for checking my post. I am trying to create a class that will play a number of mp3 loops each a specified number of times and in the specified order. I have tried to find an existing class but cant find one anywhere. My solution (which may not be that efficient), is to create all of the sound objects in the fla then load the mp3s into them. When they are all loaded each sound object is added to a new object that holds it as well as a 'loops' property that says how many times the sound object must play. These objects are then put into an array in the order they are to be heard. This array is passed to my LoopSound class that controls the playback. I can also pass a 'loopForever' property that will make the series repeat indefinitely. The problem I am having is re-triggering the play() function from within my LoopSound Class to move onto the next sound in the array. I am sure that there will be a much neater way of achieving what I want, and maybe even a pre-written class! Any direction / suggestions / encouragement much appreciated :) Thanks! Danny //this code would create an instance of the class in the FLA var mySound:Sound = new Sound(); mySound.loadSound(sounds/gas.mp3, false); //once sound is loaded: var my_ar:Array = new Array(); //create object to add to array var myOb:Object = new Object(); myOb.sound = mySound; //is to play 3 time myOb.loops = 3; my_ar.push(myOb); var myLooper:LoopSound = new LoopSound(my_ar) Here is the class: //this class is designed to play a number of already loaded sound objects sequentially, each sound object can be looped for a specified number of times then the whole series can be repeated infinitely. Th constructor is passed an array of objects that have sound and loop properties that contain a sound object and the number of times the sound object is to be looped. class LoopSound { private var sounds_ar:Array; //sound playing currently var currSound:Sound; //which stage of the array we are currently up to private var mp3Count:Number = 0; //if this series of loops is meant to keep playing until they are stopped private var loopForever:Boolean; //receives array that holds objects that have the key sound loops public function LoopSound(a:Array, lF:Boolean) { trace(loopsound created:+a); mp3Count = 0; sounds_ar = new Array(); sounds_ar = a; loopForever = lF; this.play(); } private function play() { trace(Loopsound started playing); trace(mp3 count:+this.mp3Count+:+sounds_ar); currSound = sounds_ar[mp3Count][sound]; //creating local vars for targetting from currSound complete var mp3C:Number = mp3Count; var snds_ar:Array = sounds_ar; //calculate number of times mp3 is to loop var currLoops:Number = sounds_ar[mp3Count][loops]; currSound.start(0,currLoops); currSound.onSoundComplete = function() { //if there are more sound objects to play iterate thru array and retrigger play() if (mp3Countsnds_ar.length) { mp3Count++; //this bit isn't working! play(); } else { if (loopForever) { mp3Count = 0; this.play(); } else { //all sound objects have played and play() is not retriggered mp3Count = 0; } } }; } } ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier
[Flashcoders] How do I get rid of enhanced stroke?
Hi there, I've received some graphics in an FLA from a designer and they use enhanced stroke. I need to get rid of this as I'm publishing to Flash Player 6 and I am getting compiler errors because of this. I've tried doing this by breaking the images apart but the enhanced stroke still remains. Converting the image to a bitmap looks bad as the image has diagonal lines . Any suggestions on how to do this very gratefully received, Thanks! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] How do I get rid of enhanced stroke?
Thanks Zeh and Giles, that's really helpful. I realise this isn't the place for non-codey questions now so I'll keep my posts strictly AS- related. Thanks again :) Ali On 13 Jun 2007, at 16:32, Giles Taylor wrote: Just ignore them! They are just warnings that you will lose the enhanced stroke effects and the swf will work fine. Giles -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alistair Colling Sent: 13 June 2007 16:02 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] How do I get rid of enhanced stroke? Hi there, I've received some graphics in an FLA from a designer and they use enhanced stroke. I need to get rid of this as I'm publishing to Flash Player 6 and I am getting compiler errors because of this. I've tried doing this by breaking the images apart but the enhanced stroke still remains. Converting the image to a bitmap looks bad as the image has diagonal lines . Any suggestions on how to do this very gratefully received, Thanks! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Can't set selectionColor property of List from within class
Hi there, I'm working on a class that is passed instances of components so that nearly all of the code is inside the class. I want to set the colour of selected items to white so the list always looks the same. I am trying to set the selectionColor property from within my class but I get the error message: There is no property with the name 'selectionColor' I can set this property fine from the FLA using the regular syntax: userList.selectionColor = 0xFF this is how I am doing it from my class (and it doesn't work!): function setUserList(myUserList:List) { userList = myUserList; userList.setStyle(useRollOver, false); userList.selectionColor = 0xFF; } If anyone has any ideas for the syntax of how to set this property from within a custom class I'd be really glad to hear. Thanks! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Can't set selectionColor property of List from withinclass
Thanks Muzak, that works great. I am now trying to find what property controls the green glow that appears around the whole listbox when it's hi-lighted as I want to lose that too and it doesn't seem to be mentioned in the docs. Cheers! Ali On 1 Jun 2007, at 12:49, Muzak wrote: Component styles are set through the setStyle() method. You can do this either globally or on an instance directly. Check the docs. For the list: List component Customizing the List component function setUserList(myUserList:List) { userList = myUserList; userList.setStyle(useRollOver, false); userList.setStyle(selectionColor, 0xFF); } regards, Muzak - Original Message - From: Alistair Colling [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Friday, June 01, 2007 12:27 PM Subject: [Flashcoders] Can't set selectionColor property of List from withinclass Hi there, I'm working on a class that is passed instances of components so that nearly all of the code is inside the class. I want to set the colour of selected items to white so the list always looks the same. I am trying to set the selectionColor property from within my class but I get the error message: There is no property with the name 'selectionColor' I can set this property fine from the FLA using the regular syntax: userList.selectionColor = 0xFF this is how I am doing it from my class (and it doesn't work!): function setUserList(myUserList:List) { userList = myUserList; userList.setStyle(useRollOver, false); userList.selectionColor = 0xFF; } If anyone has any ideas for the syntax of how to set this property from within a custom class I'd be really glad to hear. Thanks! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Can't set selectionColor property of List fromwithinclass
Muzak! thanks so much this is a massive help :) Have a great weekend! On 1 Jun 2007, at 17:25, Muzak wrote: _list.drawFocus = null; ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] How do i get rid of the green halo glow on listbox?
Hi there, I want to remove the green glow that appears when you rollOver items in a list box. I know how to set the colour of the theme and how to edit the graphical elements of the component from the StandardComponents.fla but I can't find the rollOver highlight MC. If someone could let me know how to alter this (or remove it completely!) that would be ace. Thanks guys:) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] How do i get rid of the green halo glow on listbox?
Thanks for your reply eric, this code seems to make the background of each item black but the green glow still appears on rollOver and also you can see faint outlines around each of the items in the list. Al I want to do is hide the green animation that shows when i rollOver an item, I guess this could be targeted in a similar way to the way you suggested or maybe the rollover event could be disabled? Any thoughts v gratefully received, Thanks! Ali On 31 May 2007, at 15:15, eric e. dolecki wrote: Here is some code that might work out for you var backAlpha = 50; var backColor = 0x00; _global.styles.ScrollSelectList.backgroundColor = undefined; // this is _global, can make it not so mx.controls.listclasses.SelectableRow.prototype.drawRowFill = function(mc:MovieClip, newClr:Number):Void { mc.clear(); if (newClr == undefined) { mc.beginFill( backColor, backAlpha ); } else { mc.beginFill( newClr, backAlpha ); } mc.drawRect(1, 0, this.__width, this.__height); mc.endFill(); mc._width = this.__width; mc._height = this.__height; if( mc._name.indexOf(tran) != -1 ) { mc.lineStyle( 1, 0x8DB600, 100, false, none, square, miter, 1 ); // thickness, rgb, alpha, pixelhinting, scaling, capstyle, jointstyle, miterLimit mc.lineTo( this._width, 0 ); mc.lineTo( this._width, 21); mc.lineTo( 0, 21); mc.lineTo( 0, 0 ); } }; On 5/31/07, Alistair Colling [EMAIL PROTECTED] wrote: Hi there, I want to remove the green glow that appears when you rollOver items in a list box. I know how to set the colour of the theme and how to edit the graphical elements of the component from the StandardComponents.fla but I can't find the rollOver highlight MC. If someone could let me know how to alter this (or remove it completely!) that would be ace. Thanks guys:) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] How do i get rid of the green halo glow on listbox?
Thanks Muzak , that's great. I have also realised I can use: this.userlist.rollOverColor = 0xFF; Thanks :) On 31 May 2007, at 16:22, Muzak wrote: You can disable the rollover behavior: _list.setStyle(useRollOver, false); Does that help? regards, Muzak - Original Message - From: Alistair Colling [EMAIL PROTECTED] To: flashcoders@chattyfig.figleaf.com Sent: Thursday, May 31, 2007 3:42 PM Subject: [Flashcoders] How do i get rid of the green halo glow on listbox? Hi there, I want to remove the green glow that appears when you rollOver items in a list box. I know how to set the colour of the theme and how to edit the graphical elements of the component from the StandardComponents.fla but I can't find the rollOver highlight MC. If someone could let me know how to alter this (or remove it completely!) that would be ace. Thanks guys:) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Where can I find the list component assets?
Hey there, I'm customizing the v2 list component but can't find the assets in the sampletheme.fla library. I have customized the scrollbar but I also want to change the outline of the list and I can't find this. Could someone point me in the right direction please? Thanks guys , have a good bank holiday :) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Where can I find the list component assets?
Hi Eric, thanks for your response. 1. I don't understand if you are unfamiliar with the concept of a Bank Holiday or maybe you just aren't having one on Monday, I hope you are. If you are unfamiliar with Bank Holidays; it is usually a Monday in the summer which essentially means that there are more barbecues and getting drunk than on a normal weekend, oh, and the banks close as well. B. I want to change the outline for the whole list Thanks :) Ali On 25 May 2007, at 15:50, eric e. dolecki wrote: 1. Bank holiday ?!? 2. Do you mean the outline around the whole list or do you wish to make an outline for items? - eric On 5/25/07, Alistair Colling [EMAIL PROTECTED] wrote: Hey there, I'm customizing the v2 list component but can't find the assets in the sampletheme.fla library. I have customized the scrollbar but I also want to change the outline of the list and I can't find this. Could someone point me in the right direction please? Thanks guys , have a good bank holiday :) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Can I read XML before it is loaded?
Thanks Danny, I think you're right, the XML Object is pretty fast and if it is going to take a while to load then storing the ID somewhere else and checking that file is probably the best way to approach this. Cheers everyone! Ali On 15 May 2007, at 15:45, Danny Kodicek wrote: Hi there, I am sure I remember coming across a way of reading an XML file before it is fully loaded though I can't find it. What I would like to do is load all the information from an XML file but only if an attribute in the first node has changed (this is like an ID that the Flash app can use to decide whether or not to load all of the XML unless it is a new version). Has anyone else heard of this of or is this wishful thinking? You could parse the initial text manually, but in fairness the XML object is pretty fast and I'd imagine you're better off just letting it load. If you want to have an ID for whether the xml has changed, why not just put one into a different file? Danny ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] How to set button event listeners within a class
Hey, thanks for checking this. I am writing a class where the onRelease event of the button is handled within the class. This is so I can make a class that can be reused across re-skinned FLAs just by passing the button instance to the class (so I don't need to assign a method of the class to it). I think I may be going about this the wrong way as I am getting lots of error messages in the compiler like: There is no method with the name 'super'. If someone could point me in the right direction here it would be a massive help, I'm worried I may be barking up the wrong tree or trying to do something that isn't possible (or sensible!). Thanks guys and have a good weekend, Ali My class code looks like this: /Send.as import mx.controls.Button; class Send extends XMLSocket { private var sendBtn:Button; function setSendBtn(mySendBtn:Button) { trace(send button received:+mySendBtn) this.sendBtn = mySendBtn; this.sendBtn._visible = false; this.sendBtn.onRelease = function() { trace(-- send pressed ); sendHandler() }; } function sendHandler(){ //send events go here trace(sendHandler called) } } The code in my FLA is: import Send; var mySend:Send = new Send(); mySend.setSendBtn(my_btn) /// ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] How to set button event listeners within a class
Thanks Merril and Rakos for yr quick responses that is brilliant :) I'll have a shot of this on Monday. Have a great weekend :) Ali On 18 May 2007, at 16:57, Rákos Attila wrote: Use some kind of delegation (e.g. mx.utils.Delegate). (off: using this is not required in AS2 classes) sendBtn.onRelease = mx.utils.Delegate.create(this, sendHandler); Attila ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Can I read XML before it is loaded?
Hi there, I am sure I remember coming across a way of reading an XML file before it is fully loaded though I can't find it. What I would like to do is load all the information from an XML file but only if an attribute in the first node has changed (this is like an ID that the Flash app can use to decide whether or not to load all of the XML unless it is a new version). Has anyone else heard of this of or is this wishful thinking? Thanks :) Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Quick syntax q: how to write a function that canreceive an undefined number of parameters
Thanks Karina this is the sort of thing I was looking for, as you say it may be clearer to code this fn the way I initially said but I was interested in how to code this another way so thanks for helping me. One tiny typo, before someone else does- for (var i = 1; iarguments.length; i++) Thanks again :) Ben, thanks for your help too, I hadn't thought of only using the square brackets to make the code more efficient. Ali On 11 May 2007, at 15:32, Karina Steffens wrote: The parameters received by a function are automatically stored in a built-in array called arguments. So you can do something like this: public static function center(obj1:Object) { var targetX:Number = ob1._x; var targetY:Number = ob1._y; for (var i = 1; iob_ar.length; i++) { arguments[i]._x = targetX+(ob1._width/2); arguments[i]._y = targetY+(ob1._width/2); } } } Btw, obj1 doesn't have to be passed seperately either - you can use var targetX:Number = arguments[0]._x; - but there's no reason to do so in your code, and this way the method is a bit more clear. The only caveat is that, depending on the rest of your code, if you have to pass an unknown number of movie clips, there's a chance your original function might actually make more sense... Cheers, Karina -Original Message- From: Alistair Colling [mailto:[EMAIL PROTECTED] Sent: 11 May 2007 12:41 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] Quick syntax q: how to write a function that canreceive an undefined number of parameters Hi there, just a quick syntax question, I want to receive a function that will centre the position of all objects passed to that of the first object passed but the number of objects passed may vary. This is the syntax I am currently using, is this the best way to do it? Thanks for any comments in advance :) Ali //ob1 is the object that the objects in the array centre themselves to public static function center(ob1:Object, ob_ar:Array) { var targetX:Number = ob1._x; var targetY:Number = ob1._y; for (var i = 0; iob_ar.length; i++) { ob_ar[i]._x = targetX+(ob1._width/2); ob_ar[i]._y = targetY+(ob1._width/2); } } center(myMC, [myMC2, myMC3, myMC4]); ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Syntax for dynamically calling a function
Wow, thanks for all your suggestions guys, Lists, I really appreciate the time you took to write your detailed response, I like your third option the best. David thanks for your suggestion I am going to do some further experimentation. I'll also have a look into the Event Dispatcher class as this looks interesting but I'm not sure what specific benefits it brings me here, I will do more research to find out. For the moment I think I will stick with putting this code inside my movie clip, and the do_ functions on the main timeline: this.onPress = function(){ this._parent[do_ + this._name].call(); } // Thanks again everyone :) On 3 May 2007, at 17:59, Lists wrote: The short answer is, you can invoke the function directly by writing: this.onPress = function () { _parent[this._name](); } or, if this looks clearer, you can use the call() method this.onPress = function () { _parent[this._name].call(); } However, there are a few issues with this approach. First, I don't like the fact that there are two things with the same name in the same scope: a function and a movie clip. This might just be me being picky, but I'll show you an example of where this breaks in a moment. Second, it's not best practice to put scripts inside movie clips. It's easier to assign these functions from the main timeline. Third, I'm not sure what this gains you. It's easier to copy and paste but, if you're already going into the movie clip manually, you might as well just type the function name. Maybe if you reused the clip from movie to movie this step would already be done and you'd only have to write the function... Or maybe I'm missing another time saving purpose. Combining all three of the above issues, you can automatically assign functions to all your movie clips from the the main timeline by writing this: (assumes mcs on stage named pictures, help, and home, and gets around same-name-in-same-scope by adding a do_ prefix to the function name) // for (var s:String in this) { if (typeof(this[s]) == movieclip) { this[x].onPress = function () { this._parent[do_ + this._name].call(); } } } function do_pictures() { trace(pictures); } function do_help() { trace(help); } function do_home() { trace(home); } // This will cause EVERY mc in the main timeline to behave this way, so this approach may not be what you want, but it's a proof of concept. You could do this through an array of all mcs you want the function assigned to, or even do it manually like this: pictures.onPress = function () { this._parent[do_ + this._name].call(); } But, again, without some sort of automation in applying the script, you lose the benefit. You might as well just write: pictures.onPress = function () { do_pictures(); } If you want to see an example of the same-name-in-same-scope problem, run the first example above after removing do_ from everything. The script will work but when it goes through and assigns the onPress event handler, it will assign it to the function pictures rather than the mc pictures. The function is seen before the mc in the execution order of the loop. Finally, if the lowercase string movieclip for typeof is confusing, you can substitute: if (this[x] instanceof MovieClip) { ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Syntax for dynamically calling a function
Hi there, I want to call a function but want to able to call it dynamically so a string that is passed will determine which function is called. My reason for this is I have an interface with a number of buttons that have different labels but that look the same and need to call different functions. I was going to make one button and duplicate it then name it so it will call a function depending on what it's name is. My code would go something like this: ///inside 'button' MC named 'pictures' var label:String = this._name this.onPress = function(){ //want to call function from here, dictated by the name of the MC, not sure of this sytanx this._parent.label() } main timeline function pictures(){ //to be called from pictures button onPress event } /// Any suggestions much appreciated! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Syntax for dynamically calling a function
Thanks Robert, I didn't know you could do that. It's a shame you can't use the same square bracket syntax in the FLA without creating a custom class, still this is a neat solution :) Cheers! Ali On 3 May 2007, at 16:04, Robert Brisita wrote: You could do something like this: class Something { method1(); method2(a_number:Number); } Somewhere else: var method_str:String = method1; var sm:Something = new Something(); sm[method_str](); // Will call method1 class method sm[method2](0x09F911029D74E35BD84156C5635688C0); // Also works ;-) Ciao, Rob. Alistair Colling wrote: Hi there, I want to call a function but want to able to call it dynamically so a string that is passed will determine which function is called. My reason for this is I have an interface with a number of buttons that have different labels but that look the same and need to call different functions. I was going to make one button and duplicate it then name it so it will call a function depending on what it's name is. My code would go something like this: ///inside 'button' MC named 'pictures' var label:String = this._name this.onPress = function(){ //want to call function from here, dictated by the name of the MC, not sure of this sytanx this._parent.label() } main timeline function pictures(){ //to be called from pictures button onPress event } /// Any suggestions much appreciated! Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com --No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 269.6.2/781 - Release Date: 4/30/2007 9:14 AM ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] The best way to monitor load progress of multiple swfs?
Hi there, I am trying to figure out the best way to monitor the load progress of swfs that are loading into each other. There are 20 swfs (of different sizes) that load into my main movie and I plan on loading my main movie into a holder so I can monitor the progress of it's download using movie clip loader class. I am fine using the Movie Clip Loader class to monitor the progress of one SWF downloading but I'm not sure how to approach checking the total progress of multiple SWFs. Previously I've created an object that holds all of the movies like this: var loadChecker:Object = new Object(); loadChecker.copyProperties = true; loadChecker.checkServer = false; loadChecker.howToPlay = false; loadChecker.chat_mc = false; each swf has this code that registers with the loadChecker object that it has loaded: _root[loadChecker][this._name] = true; and then a function that is triggered from a 3 frame looping MC checks if the movies are loaded: function checkLoaded():Boolean { var tmpBoo:Boolean = true; for (var k in _root.loadChecker) { if (!_root.loadChecker[k]) { tmpBoo = false; } } _root.moviesLoaded = true; return tmpBoo; } If someone would suggest the best way so I can monitor the progress of the loading of all SWFs so I can make a preloader that will show the progress of all SWFs that have to load that would be really good. Just a point in the right direction would be great :) Thanks, Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] RE: The best way to monitor load progress of multiple swfs?
Thanks Jack, this is exactly what i am looking for :) Cheers! Ali On 2 May 2007, at 12:23, Jack Doyle wrote: This AS2 class will handle preloading multiple SWFs and/or FLVs and/or images and report on the total progress: http://www.greensock.com/ActionScript/PreloadAssetManager Documentation examples are on the site. I think you'll find it pretty easy to implement. Enjoy. Jack Doyle -Original Message- Date: Wed, 2 May 2007 10:09:43 +0100 From: Alistair Colling [EMAIL PROTECTED] Subject: [Flashcoders] The best way to monitor load progress of multipleswfs? To: flashcoders@chattyfig.figleaf.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi there, I am trying to figure out the best way to monitor the load progress of swfs that are loading into each other. There are 20 swfs (of different sizes) that load into my main movie and I plan on loading my main movie into a holder so I can monitor the progress of it's download using movie clip loader class. I am fine using the Movie Clip Loader class to monitor the progress of one SWF downloading but I'm not sure how to approach checking the total progress of multiple SWFs. Previously I've created an object that holds all of the movies like this: var loadChecker:Object = new Object(); loadChecker.copyProperties = true; loadChecker.checkServer = false; loadChecker.howToPlay = false; loadChecker.chat_mc = false; each swf has this code that registers with the loadChecker object that it has loaded: _root[loadChecker][this._name] = true; and then a function that is triggered from a 3 frame looping MC checks if the movies are loaded: function checkLoaded():Boolean { var tmpBoo:Boolean = true; for (var k in _root.loadChecker) { if (!_root.loadChecker[k]) { tmpBoo = false; } } _root.moviesLoaded = true; return tmpBoo; } If someone would suggest the best way so I can monitor the progress of the loading of all SWFs so I can make a preloader that will show the progress of all SWFs that have to load that would be really good. Just a point in the right direction would be great :) Thanks, Ali ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Problems extending the WebServiceConnector Class
Hi there, this is my first post so hi everyone:) I am trying to extend the WSC Class into a class that will call a web service at a set interval so i can just create an instance of it in any of my movies and a listener and it will just keep sending info to the web service or trying to retrieve information from it. I am trying to access the super class of my custom class to set the vars but I cant seem to get it to work, plus the ws only triggers once and then doesn't seem to trigger again although the sendLog function is called. if anyone has any ideas, I would be really glad to hear them. Thanks :) Ali AS class CheckChat extends WebServiceConnector { var active:Boolean; //interval vars private var checkInterval:Number; private var checkFreq:Number; private var log:String; //constructor: public function CheckChat(WSDLURL, operation, suppressInvalidCalls, frequency:Number) { super(WSDLURL, operation, suppressInvalidCalls); checkFreq = frequency; } // methods: function sendLog():Void { trace(sendLog called); //could be used to send data //this.params = [log]; myWSC.trigger(); //return log; } //switches the function on and off function activate(myBoo:Boolean):Void { clearInterval(checkInterval); if (myBoo) { trace(interval set); sendLog(); checkInterval = setInterval(sendLog, checkFreq); } else { } } //this is used to add info to the log function addToLog(time:Date, type:String, info:String, id:String):Void { trace(add to log:+time+:+type+:+info+:+id); log += \r+type+: +info+:+id+ +time; trace(log is now:+log); } // events: } -FLA import mx.data.components.WebServiceConnector; import CheckChat; var myChecker:CheckChat = new CheckChat(http://myweburl/ webservice.asmx?WSDL, GetServerStatus, true, 3000); var res:Function = function (evt:Object) { trace(+evt.target.results); }; myChecker.addEventListener(result, res); myChecker.activate(true); /// ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com