[Flashcoders] runtime instantiation
I know it is possible to instantiate a class at runtime, but one always needs to put in a concrete piece of code that forces the compiler to actually add the class to the swf. I am currently looking into using this technique to gain flexibility in an application, but the fact that I will always need to add concrete code to force the compiler seems to be counter productive. Here is what I have. interface aInterface class abstractA impl aInterface class injectedB extends abstractA class injectedC extends abstractA then I have a factory method that reads an xml file and instantitated a class based on the @reference node using getDefinitionByName() class reference='injectedB' / My idea is that I can in the future write an new class injectedC and just add it to the xml list. But this won't work because I will always need to add something like this to var foo:injectedC = null to add the class to the compiler. Meaning I will always need to recompile. Is there any way to get around this? Jiri artur wrote: need to know a few things: 1 - can i render/export to QT an AS based animation that will be 40min long? it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will trigger different AS animations made from an XML file. is there a chance that the animation and sound can become out of sync ( this has been known to happen with timeline based animations ) 2 - the FLV will have over 10k cuepoints. is there a way to Scrub through to the middle of the animation by giving an ID# to each CuePoint? and then giving each XML node that same ID#? then just create a simple textfield form and have the client enter that ID# and the animation can Jump to that section of the animation ( for testing/previewing ) but then how can the client add/delete cuepoints in the FLV and have them be resorted numerically? so they can match the xml IDs? im sure there is a clever flexible solution out there..anyone? thanks! p.s. i need to do this in AS2..if possible. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] runtime instantiation
If you want to add a class in the future, you will definitely have to recompile, because flash doesn't compile at runtime as far as I know. But I have also looked for a way to simply import classes without also having a var defined. It's not too big a deal, but it's an interesting topic. 2008/10/28 Jiri Heitlager [EMAIL PROTECTED]: I know it is possible to instantiate a class at runtime, but one always needs to put in a concrete piece of code that forces the compiler to actually add the class to the swf. I am currently looking into using this technique to gain flexibility in an application, but the fact that I will always need to add concrete code to force the compiler seems to be counter productive. Here is what I have. interface aInterface class abstractA impl aInterface class injectedB extends abstractA class injectedC extends abstractA then I have a factory method that reads an xml file and instantitated a class based on the @reference node using getDefinitionByName() class reference='injectedB' / My idea is that I can in the future write an new class injectedC and just add it to the xml list. But this won't work because I will always need to add something like this to var foo:injectedC = null to add the class to the compiler. Meaning I will always need to recompile. Is there any way to get around this? Jiri artur wrote: need to know a few things: 1 - can i render/export to QT an AS based animation that will be 40min long? it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will trigger different AS animations made from an XML file. is there a chance that the animation and sound can become out of sync ( this has been known to happen with timeline based animations ) 2 - the FLV will have over 10k cuepoints. is there a way to Scrub through to the middle of the animation by giving an ID# to each CuePoint? and then giving each XML node that same ID#? then just create a simple textfield form and have the client enter that ID# and the animation can Jump to that section of the animation ( for testing/previewing ) but then how can the client add/delete cuepoints in the FLV and have them be resorted numerically? so they can match the xml IDs? im sure there is a clever flexible solution out there..anyone? thanks! p.s. i need to do this in AS2..if possible. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- The Random Lines My online portfolio www.therandomlines.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
I'm afraid I don't think either Han's or Steven's solutions work in AS3 - you'd still get a ReferenceError (unless currentSection is dynamic). I'd do it using flash.utils.describeType, like so: import flash.utils.describeType; : var desc:XML=flash.utils.describeType(currentSection); if (desct.method.(@name==refresh).length()0) { currentSection['refresh'](); /// Still need bracket access here, as otherwise compilation will fail } Wrapping it up, here's a method-checking function: function methodExists(obj:Object,name:String):Boolean { var desc:XML=flash.utils.describeType(obj); return (desc.method.(@name==name).length()0); } (and here, for free, is one for properties: function propertyExists(obj:Object,name:String):Boolean { var desc:XML=flash.utils.describeType(obj); return (desc.accessor.(@name==name).length()0); } ) It's heavyweight, though. If anyone can find a better solution... Ian On Tue, Oct 28, 2008 at 2:09 AM, Steven Sacks [EMAIL PROTECTED] wrote: if (currentSection.refresh) { currentSection.refresh(); } Karim Beyrouti wrote: Hello Group - This should be really easy. I am trying to find out how to check if a function exists or not in AS3 - I tried this: code If ( currentSection.refresh != null ) { currentSection.refresh(); } /code But I get ReferenceError: Error #1069: Property refresh not found when the function does not exist. Any clues? Kind Regards Karim ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian On Tue, Oct 28, 2008 at 8:33 AM, Ian Thomas [EMAIL PROTECTED] wrote: I'm afraid I don't think either Han's or Steven's solutions work in AS3 - you'd still get a ReferenceError (unless currentSection is dynamic). I'd do it using flash.utils.describeType, like so: import flash.utils.describeType; : var desc:XML=flash.utils.describeType(currentSection); if (desct.method.(@name==refresh).length()0) { currentSection['refresh'](); /// Still need bracket access here, as otherwise compilation will fail } Wrapping it up, here's a method-checking function: function methodExists(obj:Object,name:String):Boolean { var desc:XML=flash.utils.describeType(obj); return (desc.method.(@name==name).length()0); } (and here, for free, is one for properties: function propertyExists(obj:Object,name:String):Boolean { var desc:XML=flash.utils.describeType(obj); return (desc.accessor.(@name==name).length()0); } ) It's heavyweight, though. If anyone can find a better solution... Ian On Tue, Oct 28, 2008 at 2:09 AM, Steven Sacks [EMAIL PROTECTED] wrote: if (currentSection.refresh) { currentSection.refresh(); } Karim Beyrouti wrote: Hello Group - This should be really easy. I am trying to find out how to check if a function exists or not in AS3 - I tried this: code If ( currentSection.refresh != null ) { currentSection.refresh(); } /code But I get ReferenceError: Error #1069: Property refresh not found when the function does not exist. Any clues? Kind Regards Karim ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
Method: public static function refExists(obj:Object,name:String):Boolean { try { if (obj[name]!=null) return true; } catch (e:ReferenceError) {} return false; } HTH, Ian On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas [EMAIL PROTECTED] wrote: Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flash 9 Mac Debugger Default Display
Is there any way to save the layout, pane size, column sizes in panes, etc., of the debugger display in Flash 9 on the Mac? When my debugger opens it opens at a small, unusable window size with the code view pane only a few pixels wide and the overall window size really small. I have to stretch the window to make it usuable and I have to adjust the variable view pane columns to make them display a variable name and value. I have had times were it would open at the previous size and layout, but don't know how I got there. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] h264 video looks blurry/crappy in flash
Check: Is your video pixel aspect ratio square pixels 1:1 ? or for ex. 1:1.07 or 1:1.333. Søren Christensen wrote: The video i am using has the same size as the stage area so no scaling is taking place. smoothing = true normally activates antialiasing if the video is scaled up/down. However weird things hapens with h264 - with smoothing 'on' the image gets too soft and to some degree degrades the picture. With smoothing 'off' it leaves the video very rough and aliased as if the video had been scaled up from 1/4th the resolution. I have been testing on osx 10.4 safari/ff and 9.0.115 fp Cheers, B) Søren MOTION INTERACTIVITY dslnc studio - www.desilence.net +34 93 268 0953 / +34 61 555 9963 (mobile) On Oct 24, 2008, at 5:37 PM, Cedric Muller wrote: do you, by any chance, use the video.smoothing = true ? by looking at the video, it seems this option is set to true ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] AS3 - Checking if a Function Exists
This is great - thank you -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: 28 October 2008 08:46 To: Flash Coders List Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists Method: public static function refExists(obj:Object,name:String):Boolean { try { if (obj[name]!=null) return true; } catch (e:ReferenceError) {} return false; } HTH, Ian On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas [EMAIL PROTECTED] wrote: Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian ___ 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] Defenition of a Motion Designer...
Just to check other people's definition of a Motion Designer. What do you think a motion designer should be doing? Thnx in advance... ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] runtime instantiation
One way to do this is to compile the class into a swf that you load. Essentially you are creating modules or dlls. You just have to handle loading them yourself. I have been using the technique for a while on a project and it works great. Steve On Tue, Oct 28, 2008 at 12:13 AM, Jiri Heitlager [EMAIL PROTECTED] wrote: I know it is possible to instantiate a class at runtime, but one always needs to put in a concrete piece of code that forces the compiler to actually add the class to the swf. I am currently looking into using this technique to gain flexibility in an application, but the fact that I will always need to add concrete code to force the compiler seems to be counter productive. Here is what I have. interface aInterface class abstractA impl aInterface class injectedB extends abstractA class injectedC extends abstractA then I have a factory method that reads an xml file and instantitated a class based on the @reference node using getDefinitionByName() class reference='injectedB' / My idea is that I can in the future write an new class injectedC and just add it to the xml list. But this won't work because I will always need to add something like this to var foo:injectedC = null to add the class to the compiler. Meaning I will always need to recompile. Is there any way to get around this? Jiri artur wrote: need to know a few things: 1 - can i render/export to QT an AS based animation that will be 40min long? it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will trigger different AS animations made from an XML file. is there a chance that the animation and sound can become out of sync ( this has been known to happen with timeline based animations ) 2 - the FLV will have over 10k cuepoints. is there a way to Scrub through to the middle of the animation by giving an ID# to each CuePoint? and then giving each XML node that same ID#? then just create a simple textfield form and have the client enter that ID# and the animation can Jump to that section of the animation ( for testing/previewing ) but then how can the client add/delete cuepoints in the FLV and have them be resorted numerically? so they can match the xml IDs? im sure there is a clever flexible solution out there..anyone? thanks! p.s. i need to do this in AS2..if possible. ___ 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] runtime instantiation
There is a way to do it - rather than update your code with a reference, you can force the compiler to include it by using the compiler option: -includes Class [Class] e.g. mxmlc Main.as -output Main.swf -includes com.pack.MyClass com.pack.MyOtherClass Obviously you still need to recompile - but you don't need to update any .as or MXML files. HTH, Ian On Tue, Oct 28, 2008 at 7:13 AM, Jiri Heitlager [EMAIL PROTECTED] wrote: I know it is possible to instantiate a class at runtime, but one always needs to put in a concrete piece of code that forces the compiler to actually add the class to the swf. I am currently looking into using this technique to gain flexibility in an application, but the fact that I will always need to add concrete code to force the compiler seems to be counter productive. Here is what I have. interface aInterface class abstractA impl aInterface class injectedB extends abstractA class injectedC extends abstractA then I have a factory method that reads an xml file and instantitated a class based on the @reference node using getDefinitionByName() class reference='injectedB' / My idea is that I can in the future write an new class injectedC and just add it to the xml list. But this won't work because I will always need to add something like this to var foo:injectedC = null to add the class to the compiler. Meaning I will always need to recompile. Is there any way to get around this? Jiri artur wrote: need to know a few things: 1 - can i render/export to QT an AS based animation that will be 40min long? it will be incorporating an FLV ( soundtrack ) with Cuepoints..that will trigger different AS animations made from an XML file. is there a chance that the animation and sound can become out of sync ( this has been known to happen with timeline based animations ) 2 - the FLV will have over 10k cuepoints. is there a way to Scrub through to the middle of the animation by giving an ID# to each CuePoint? and then giving each XML node that same ID#? then just create a simple textfield form and have the client enter that ID# and the animation can Jump to that section of the animation ( for testing/previewing ) but then how can the client add/delete cuepoints in the FLV and have them be resorted numerically? so they can match the xml IDs? im sure there is a clever flexible solution out there..anyone? thanks! p.s. i need to do this in AS2..if possible. ___ 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] Printing filters from the Flash Player
Hi Glen, This is quite similar to what we did. We first created a BitmapData of the scene and then printed that. Even posted about it :-) http://techblog.floorplanner.com/2008/10/22/printing-and-big-bitmaps/ But it feels like there should be an easier way... Gert-Jan 2008/10/25 Glen Pike [EMAIL PROTECTED] Hi, Here is some AS2 code that I wrote to do this - the _toPrint is a MovieClip containing lots of stuff with filters on. There is scaling too - depending on whether the user has chosen portrait or landscape - for later AS3 code, I worked out the orientation and rotated the printed image - not bitmapped though... The whole lot is rendered to a Bitmap, then printed. Hope this helps. I may even get round to blogging it one day :) Glen private function _print():Void { //start a print job with the _toPrint... // create PrintJob object var my_pj:PrintJob = new PrintJob(); // display print dialog box, but only initiate the print job // if start returns successfully. if (my_pj.start()) { // use a variable to track successful calls to addPage var pagesToPrint:Number = 0; //we need to scale the object too! var h:Number = my_pj.pageHeight; var w:Number = my_pj.pageWidth; var xs = w / _toPrint._width; var ys = h / _toPrint._height; trace(page dimensions + w + , + h + scale + xs + , + ys + to print + _toPrint._xscale + , + _toPrint._yscale ); var _printWidth:Number; var _printHeight:Number; var scale:Number = (xs ys) ? xs : ys; if (xs ys) { _printWidth = Math.floor(xs * _toPrint._width); _printHeight = Math.floor(xs * _toPrint._height); } else { _printWidth = Math.floor(ys * _toPrint._width); _printHeight = Math.floor(ys * _toPrint._height); } trace(to print + _toPrint._xscale + , + _toPrint._yscale + = + _toPrint._width + , + _toPrint._height); // add specified area to print job //now do our bitmap thingy.. var printedImg:MovieClip = this.createEmptyMovieClip(printedImg, this.getNextHighestDepth()); printedImg.beginFill(0xff, 1); printedImg.moveTo(0, 0); printedImg.lineTo(my_pj.pageWidth, 0); printedImg.lineTo(my_pj.pageWidth, my_pj.pageHeight); printedImg.lineTo(0, my_pj.pageHeight); printedImg.lineTo(0, 0); printedImg.endFill(); var printBmp:BitmapData = new BitmapData(my_pj.pageWidth, my_pj.pageHeight, false, 0xff); printedImg.attachBitmap(printBmp, 1); var mtx:Matrix = new Matrix(); mtx.scale(scale, scale); printBmp.draw(_toPrint, mtx); // repeat once for each page to be printed if (my_pj.addPage(printedImg, null, {printAsBitmap:true})) { pagesToPrint++; } _toPrint._xscale = _toPrint._yscale = 100; if (pagesToPrint 0) { my_pj.send(); // print page(s) } printBmp.dispose(); delete printBmp; printedImg.unloadMovie(); } } Gert-Jan van der Wel wrote: Hi Jim, Yeah we tried the printAsBitmap option, but it didn't make much of a difference. We're now looking at creating a BitmapData and printing that. Maybe that works. Gert-Jan Op 24 okt 2008, om 15:17 heeft Jim McIntyre het volgende geschreven: Gert-Jan van der Wel wrote: Hi there, We use filters (shadows and glows) to make the scene look better. At some point a user can print what they've created, but the print shows no filters. Is there an easy way to get the filters on the print? Have you tried printAsBitmap? I found that was the only way to get some stuff to print the same way it was displayed, even when filters weren't involved (like some hand-drawn shadows using transparent fills). My project was written in AS2; I don't know whether the implications are different for code running in AVM2. (code simplified from my app, untested) -- private function printPoster():Void { var posterPrintJob:PrintJob = new PrintJob(); if (posterPrintJob.start()) { var pgsQueued:Number = 0; this.printPg._visible = true; //printPg is the MovieClip to print var printArea:Object = {xMin:0, xMax:printPg._width, yMin:0, yMax:printPg._height}; var printOptions:Object = {printAsBitmap:true}; if (posterPrintJob.addPage('printPg', printArea, printOptions)) { pgsQueued++; } if (pgsQueued) { posterPrintJob.send(); } } } -- ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
*sigh* How stupid am I - someone has just pointed out that the built-in Object.hasOwnProperty() does this perfectly well. :-) So try: if (currentSection.hasOwnProperty('refresh')) { currentSection['refresh'](); } That'll teach me not to read every line of the docs. ;-) Ian On Tue, Oct 28, 2008 at 2:13 PM, Karim Beyrouti [EMAIL PROTECTED] wrote: This is great - thank you -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: 28 October 2008 08:46 To: Flash Coders List Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists Method: public static function refExists(obj:Object,name:String):Boolean { try { if (obj[name]!=null) return true; } catch (e:ReferenceError) {} return false; } HTH, Ian On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas [EMAIL PROTECTED] wrote: Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 associativ array length=0
It's normal behavior for AS3. In fact, there is no Associative Array in AS3 (that's a PHP term and convention). You'd want to look into using a Dictionary object or iterating over a dynamic object: var foo:Object ={item1: val, item2: val}; var count:int = 0; for (var bar:* in foo) { trace(bar); count++; } trace(count); Kevin N. laurent wrote: Hi, I use an array to store object with their name like that: views[ viewName ] = Object then views.length return 0 ... It's normal behaviour ?? length work only on numerical indexes ? L ___ 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] Defenition of a Motion Designer...
designing motion. http://en.wikipedia.org/wiki/Motion_graphic_designhttp://en.wikipedia.org/wiki/Motion_graphic_design hth! :) On Tue, Oct 28, 2008 at 7:36 AM, Sander Schuurman [EMAIL PROTECTED] wrote: Just to check other people's definition of a Motion Designer. What do you think a motion designer should be doing? Thnx in advance... ___ 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] Defenition of a Motion Designer...
My personal idea: Bring motion, life and foremost emotion to static assets trough animation or scripting. With or without interaction and on different electronic media. Sander Schuurman wrote: Just to check other people's definition of a Motion Designer. What do you think a motion designer should be doing? Thnx in advance... ___ 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] FP Version - cached??
Hi, This may be a wierd one, but I have just upgraded my player to version 10, then ran into problems with Wordpress' file upload breaking. So, using my trusty Flash Player Switcher, I swapped versions to 9 and tried again - still encountering the same problem. Just to make sure it had swapped, I checked the version on another site - reported 9.0.124.0 WTF?? It was not until I cleared my cache (FF2) and tried again with the file upload page on WP that it worked. So, can someone tell me. Is there some weird cache issue where the Flash Player version is tied into cached SWF's, or am I being really dumb / paranoid / working too many hours. Or is this some wierd issue with using Flash Player Switcher? Anyone seen this before? Ta Glen -- Glen Pike 01326 218440 www.glenpike.co.uk http://www.glenpike.co.uk ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
Do not call return in a try catch. Ian Thomas wrote: Method: public static function refExists(obj:Object,name:String):Boolean { try { if (obj[name]!=null) return true; } catch (e:ReferenceError) {} return false; } HTH, Ian On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas [EMAIL PROTECTED] wrote: Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 - Checking if a Function Exists
- Original Message - From: Steven Sacks [EMAIL PROTECTED] To: Flash Coders List flashcoders@chattyfig.figleaf.com Sent: Wednesday, October 29, 2008 2:20 AM Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists Do not call return in a try catch. Are you suggesting that as bad practice, or because you know the compiler isn't clever enough to sort it out properly? Ian Thomas wrote: Method: public static function refExists(obj:Object,name:String):Boolean { try { if (obj[name]!=null) return true; } catch (e:ReferenceError) {} return false; } HTH, Ian On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas [EMAIL PROTECTED] wrote: Or, thinking about it, you could catch the reference error in a try/catch block. It's more of a kludge, but might give you much higher performance! Ian ___ 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