Recent News

check if swf is a local or online file

Posted by sortofme on October 5th, 2009

Often, when projects become bigger and more complicated, it often is necessary gto let the application behave different when exported within the IDE and the actual LIVE project. I use this snippet, right at the beginning of my baseclass, to define in which environment the flash client is running:

Actionscript:
  1. if(stage.loaderInfo.url.indexOf("file:") != -1){
  2.     _configXmlPath = "config.xml";
  3.        trace("local file");
  4. }else {
  5.     trace("Server");
  6.     domain = URLUtils.getDomain( stage.loaderInfo.url);
  7. }

I hope this is seflexpainatory.

colormatrix filter change the Hue

Posted by sortofme on July 21st, 2009

Or you could just randomize the “hue” color parameter which is handily a 0-360 scale in TweenFilterLite:

theHue = (Math.round(Math.random() * 360)) ;
TweenFilterLite.to(my_mc, 2, {colorMatrixFilter:{amount:1, hue:theHue}});

disabling the yellow tab Borders in Flash

Posted by sortofme on June 29th, 2009

Flash has these bright yellow borders around buttons and other MovieClips, when the user uses his tab keys. I haven't found a way to change the look of these borders yet, so in the meantime, to have them disabled, I use following short code snippet:


Button.prototype.tabEnabled=false;
for(var obj in _root){
   _root[obj].tabEnabled = false;
   _root[obj]._focusrect=false;
}

ActionScript 3: Using URLLoader to send and load server variables « Tushar Wadekar

Posted by sortofme on June 22nd, 2009

ActionScript 3: Using URLLoader to send and load server variables « Tushar Wadekar

here is the most accurate description on how to send vars to a server script from flash, without opening anew browser window

aborting a loading

Posted by sortofme on June 12th, 2009

In AS3 only, you can now abort a loading operation, before it has completed.
Senocular has written a post about it here.

in summary:

var loader:Loader = new Loader(); var request:URLRequest = new URLRequest("image.jpg"); loader.load(request); addChild(loader); // abort loading if not done in 3 seconds var abortID:uint = setTimeout(abortLoader, 3000); // abort the abort when loaded loader.contentLoaderInfo.addEventListener(Event.COMPLETE, abortAbort); function abortLoader(){     try {         loader.close();     }catch(error:Error) {} } function abortAbort(event:Event){     clearTimeout(abortID); }

Nasty Yellow Highlight on Buttons When “Tabbing” « Gena’s Blurb

Posted by sortofme on June 8th, 2009

Nasty Yellow Highlight on Buttons When “Tabbing”When you’re in a flash movie and you hit the “tab” button to go from button to button flash likes to put a bright bold yellow highlight around the button that is awfully ugly and annoying. This is how you get rid of that awful yellow highlight that flash produces by default.

movieClipName.tabEnabled = false;

Note: this code will also make the button not “tabbable”. Now when you hit the tab button on the keyboard it will ignore that button all together. You can still utilize it with ‘getfoucus’.

if you have nested moveclips then use this code too:
parentMovieClipName.tabChildren = false;

No more nasty default yellow highlights around anything that is tabbable in your flash movies.

Nasty Yellow Highlight on Buttons When “Tabbing” « Gena’s Blurb

Tweensy, a new slick AS3 animation package goes public`

Posted by sortofme on May 27th, 2009

Tweensy, developed by the notorious "Lost in Actionscript" blog owner Shane McCartney. I am personally a fan of Greensock's Tweenlite package, and there aren't any AS3 projects I haven't used it, but I must say Tweeny is the first one that actually woke my attention. It seems slick, fast, (very fast), and best of all are the effect packages it can be extended with. I also tried out the abilities to tween along complicated motion guides, and must say, I was really waiting for that one!
I will keep a few of my experiments with it posted here, but hey, flash community, there is movement!!

http://www.lostinactionscript.com/blog/index.php/2009/01/05/tweensy-goes-public/

Flash Cool Sites

Posted by sortofme on October 8th, 2008

Here a small collection of my favourite discoveries of flash sites.

loading external images

Posted by sortofme on August 5th, 2008

quick recollection of best practices when loading an image (or any asset) into a flash movie from an external location.

Actionscript:
  1. import flash.display.Loader;
  2. import flash.display.MovieClip;
  3. import flash.events.Event;
  4. import flash.events.IOErrorEvent;
  5. import flash.net.URLRequest;
  6.  
  7. private function ldImage(imagePath:String) {
  8.     throwAlert("loading " + imagePath);
  9.     var _loader:Loader = new Loader();
  10.     _loader.contentLoaderInfo.addEventListener(Event.INIT, onLdInit);
  11.     _loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR  , onLdError);
  12.     _loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLdComplete);
  13.     var urequest:URLRequest = new URLRequest(imagePath);
  14.     _loader.load(urequest);
  15.     addChild(_loader)
  16. }
  17. private function onLdError(e:Event) {
  18.     trace(this+" !!! onLoad ERROR !!!\n"+e);
  19. }
  20. private function onLdInit(e:Event) {
  21.     trace(e + " onLod Init");
  22. }
  23. private function onLdComplete(e:Event) {
  24.     trace(e + " onLdComplete");
  25. }

flash full browser with swfObject 2

Posted by sortofme on July 9th, 2008

Having had difficulties to find a rather complete description on this very common subject, I thought I might as well compile a selection of techniques necessary to accomplish this.

first, let's go through the requirements within the HTML page and the swfObject javascript, which comes into the head of the HTML page embedding the swf:
more about the use of the swfObject here-->

HTML:
  1. <script type="text/javascript" src="js/swfobject.js"></script>
  2.     <script type="text/javascript"> 
  3.         //vars and parameters for embedded swf
  4.         var flashvars = { };
  5.         var params = { menu: "false", allowScriptAccess:"sameDomain", allowfullscreen :"true"};
  6.         var attributes = { id: "main", name: "main" };
  7.         swfobject.embedSWF("flash/main.swf", "mainFlash", "100%", "100%", "9.0.0","expressInstall.swf", flashvars, params, attributes); 
  8.     </script>
  9. <style type="text/css">
  10. <!--
  11.   html, body, #mainFlash{ height:100%; width:100%;}
  12.   body { margin:0; padding:0; overflow:hidden; background-color:#A31724; text-align:center; }
  13. -->
  14. </style>

    Set both the width and height of your SWF to 100% in your SWFObject definition.
    Include CSS to get rid of any default margins/padding and set the height of the html element, the body element and the entire chain of block level HTML elements that your SWF will be nested in to 100%, because Firefox (or: any Gecko based browser) in standards compliant mode (or: using a valid DOCTYPE) interprets percentages in a very strict way (to be precise: the percentage of the height of its parent container, which has to be set explicitly)

Now go to your flash movie, and manage the scaling and alignment of your SWF and the positioning of your SWF's elements, within your ActionScript code, e.g.:

Actionscript:
  1. stage.scaleMode = StageScaleMode.NO_SCALE;
  2. stage.align = StageAlign.TOP_LEFT;
  3.  
  4. stage.addEventListener(Event.RESIZE, resizeHandler);
  5.  
  6. function resizeHandler(event:Event):void {
  7.    trace(stage.stageWidth + " x " + stage.stageHeight);
  8.   // center stuff
  9. }

Recent Comments | Recent Posts


designed and coded by: noesi
bottom