[flexcoders] Re: Modularising a flex app
We have an app that has a number of parts that are not all required for all customers. What's the best way to build it to minimise file size and for ease of building and code maintenance? We currently keep the code separated in different classes and mxml components, so we can do things like comment out things we don't want to reduce the size of an individual build but I'm figuring there must be a better way. Currently we are building in FB2, but are about to upgrade to FB3, if that makes a difference. to use Modules you need FB3, FB2 does not have that after if you want to select part of the app at compilation time you can use conditionnal compilation in Flex http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html RSL can also help to modularize your application but honest there is not one easy way to do modularization
[flexcoders] Re: override/monkey patch global functions possible?
Hi, Is it possible to override global functions such as trace( ) ?� For example, sometimes I want the trace( ) to tell me where they are called from, but it's kinda a pain to have to import getQualifiedClassName and sprinkle code with stuff like (getQualifiedClassName(this) + : + ...); all over the place. you can override the global trace function at the class level package foobar { public class MyClass { public function MyClass() { trace( hello world ); //output [ hello world ] } protected function trace( ...args ):void { args.unshift( [ ); args.push( ] ); var msg:String = args.join( ); public::trace( msg ); //thanks namespaces } } } if you're using a debug version of flash you can use a StackTrace trick to have more infos in your overrided trace protected function trace( ...args ):void { var stackTrace: String; try { throw new Error(); } catch ( e:Error ) { stackTrace = e.getStackTrace(); } stackTrace = stackTrace.split( \n )[2]; args.unshift( getTimer() + - [ ); args.push( ] - + stackTrace ); var msg:String = args.join( ); public::trace( msg ); } will output something like 123 - [ hello world ] - at foobar::MyClass/MyClass()[/tmp/foobar/MyClass.as:12] alos you can use flash.trace.Trace and you will really trace everything and maybe more than you wish (undocumented in Flash but documented in the Tamarin project http://hg.mozilla.org/tamarin-central/index.cgi/file/e774dfe22b39/extensions/Trace.as) by default import flash.trace.Trace Trace.setLevel( Trace.METHODS_AND_LINES_WITH_ARGS, Trace.OFF ); with your own function listener public function traceListener( line:String, index:int, method:Sring, args:String ):void { trace( @+index + - + line ); trace( method+(+args+) ); } import flash.trace.Trace Trace.setListener( traceListener ); Trace.setLevel( Trace.METHODS_AND_LINES_WITH_ARGS, Trace.LISTENER ); enjoy :) zwetan
[flexcoders] Re: Anyone have a good resource on singletons?
Hi, here I got a way to do it here http://code.google.com/p/maashaack/wiki/Singleton note that a lot of people will debate on how to define singleton in AS3, I don't say that the solution I mention above is the best but imho it's the most standard-way to do it and the closest to the AS3 language (and if someone want to debate that come with good arguments, just saying duh Java use getInstance() so we should do the same that will not qualify as a good argument) cheers, zwetan --- In flexcoders@yahoogroups.com, Scott [EMAIL PROTECTED] wrote: I'm trying to find information on using singletons in AS3/Flex. I've got an .AS file set up but I'm having issues calling the data/functions within that function in other classes. Does anyone have a good resource on the web for creating and using singletons? Thanks!
[flexcoders] Re: will we have access to makeplayerglobal script ?
* AS3 does support the ability to extend builtin objects by adding prototype methods. Yes, you give up something (strong type checking) but it's no worse than in AS1 when it worked. Actually AS1, AS2, and AS3 all support this. duh !! I was so used to do some hacks to circumvent the AS2 compiler to allow such addition inside prototype that I didn't even tryed to directly add such methods to the prototype with AS3. Lol the tree hidding the forest :) all is working, ok I lost the compile-time static type check, but as all this methods are heavyly unit tested, not really a problem. * I suppose if you recompiled playerglobal.as with new methods in it, and took pains to add those methods as prototype methods, you could get back some of the lost compile-time checking. The bytecode you generated would still be compatible with prototype methods added on the fly at runtime. that's the goal, and it already working with AS2 1) update the intrinsic class by adding intrinsic methods 2) include the files containing the prototype 3) you have added methods with compile-time check I have no idea if we're looking at providing the playerglobal source (maybe we are since we're hoping to provide the framework source) but I can't imagine it will be a well-documented feature as to how to adjust it and re-compile... I'll forward this to PM though and they can take it under consideration. even with almost no documentation (just the basic :)) I would like a lot to be able to do that, well if possible... but at least now I'm not blocked in what I planned to code. Yahoo! Groups Sponsor ~-- Most low income households are not online. Help bridge the digital divide today! http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] Re: will we have access to makeplayerglobal script ?
Hmm, I wouldn't count on getting to mess with those files (or messing with them having any effect right now). I'll forward this on to the player team though. Really I don't try to mess with anything :). My point is only look at the core system class from .NET and Java compare them to AS3, there are really things missing. I don't particulary want to add myself such methods as endswith/startswith, I would rather prefer to have them native, just for the speed. And I'm almost sure I would not be the only one wanting suhc methods added to the coe objects. Anyway thanks for forwarding that request. zwetan Yahoo! Groups Sponsor ~-- Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
[flexcoders] will we have access to makeplayerglobal script ?
Hello, exploring a little more in depth how Flex2 compilation work I found in ..\Flex2alpha1\plugins\zorn.codemodel_2.0.197\resources 2 very interesting files Global.as and playerglobal.as I don't know for others but for me these 2 files are more valuable than anyother AS3 documentation It help a lot to read these codes and their comments (even internal API SCRUB :)) to have a better understanding of how things are built. My concern about those files is that I was looking for if in ActionScript 3 we can do something like that - namespace StringExtension; StringExtension extend(String) function scramble():String {...} StringExtension extend(String) function unscramble():String {...} use namespace(StringExtension); var x:String = abc.scramble(); - as described here http://www.mozilla.org/js/language/es4/rationale/miscellaneous.html If we can not do that in AS3, can we at least have access to the makeplayerglobal script to build Global.abc and playerglobal.abc ? or can we vote to add some methods (very needed) to the Global object ? the rational behind that: Either with the Java framework or the .NET framework we have access to very usefull core class methods indexOfAny (String, Array), String.format, equals, etc. I think it could be usefull to system programmers to be able to implement such core methods to Global.as and perharps playerglobal.as it would reduce the platform shift a lot if you were used to code in .NET/Java And as I love to see a StringBuilder class in AS3, I would love also to be able to use String::equals, String::copyTo, String::copy etc. When I see in Global.as /** * @private Central API */ public native function endswith(endString:String):Number; // Central API but I don't see any startswith method I really wonder how I could add such a method with AS1, it's easy , you juste need to define it in the prototype with AS2, it's a little less easy, but you can still do it you modify the intrinsic class, and you include a AS1 file which implement the functionnality with AS3 ? what option do we have ? Even if I understand fully that those core objects need to be native and not overloaded to assure speed , I would like to have an option to add to them the logic is simple when I look to the .Net String class I don't care if the class is sealed/final all the options that I find usefull are already defined in the class but when I look to the AS3 String class I feel stuck because a lot of basic and usefull methods are missing if we could augment the Global.as and playerglobal.as AS3 programmer could implement something as Mono but for Flex2. zwetan Yahoo! Groups Sponsor ~-- Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM ~- -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/