Recent News

slim flex tool for creating icons online

Posted by sortofme on January 4th, 2009

http://converticon.com/

small slim flex application where yo can upload your image and convert it into an .ico file.

 

very useful flash / Air / as3 trace and debug tool

Posted by sortofme on November 19th, 2008


A new tool I love using, first it is in AIR, secondly immensely useful, is from Arthropod this little AIR application that let's you trace debug messages even from an embedded swf.

I never was a fan of Adobe's debug flash player, as it sometimes did cause weird behavior, especially after upgrading to FF3. So this little Air app gives you a wide range of functions to organise your debug traces well, including coloring, clearing, even snapshots of current Application, as I said even for in HTML embedded swfs or Air apps.
give it a go:

simply add the class to your source, import and use it:

Actionscript:
  1. import com.carlcalderon.arthropod.Debug;
  2.  
  3. //later:
  4. Debug.log(this+" my debug message" )

there are many other ways to trace, read the documentation for more info

flashvar parameters

Posted by sortofme on October 28th, 2008

I often cam across the issue, especially when working with XML data, that I want to pass on many of the paths used for loading XML or other tyoes of media from the embedding source, rather than hard coding it into my swf. That is fine, but I always run into the problem, that during development, the paths actually used on the server are wwuite unhandy for my IDE development.

Thats why I document here how I usually handle this, by checking whether the file is being served from local, or whther it is on a server:

Actionscript:
  1. if(stage.loaderInfo.url.indexOf("file:") != -1){
  2.     trace("Local");
  3.     _XMLPath ="album1.xml"
  4. }else {
  5.     _XMLPath = root.loaderInfo.parameters.imageXMLPath;
  6.     trace("Server");
  7. }

Timer

Posted by sortofme on October 16th, 2008
Actionscript:
  1. // We need to import the utils package
  2. import flash.utils.*;
  3.  
  4. // Create a new Timer object with a delay of 500 ms
  5. var myTimer:Timer = new Timer(500);
  6. myTimer.addEventListener( TimerEvent.TIMER, timedFunction);
  7.  
  8. // Start the timer
  9. myTimer.start();
  10.  
  11. // Function will be called every 500 milliseconds
  12. function timedFunction(eventArgs:TimerEvent){
  13. trace(”Timer fired ” + myTimer.currentCount + ” times.”);
  14. }

retrieve all children contained within a movieclip

Posted by sortofme on October 8th, 2008

Code snipplet to retieve all children contained within a movie clip:

Actionscript:
  1. public function getAllChildren(target_mc):Array {
  2. var childrenArray:Array = new Array;
  3. for (var i:uint = 0; i <target_mc.numChildren; i++){
  4. //trace ('t ' +i + ' name:' + target_mc.getChildAt(i).name + '\t type:' + typeof (target_mc.getChildAt(i)) + '\t' + target_mc.getChildAt(i));
  5. childrenArray.push(target_mc.getChildAt(i));
  6.  
  7. }
  8. return childrenArray;
  9. }

Flash Cool Sites

Posted by sortofme on October 8th, 2008

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

Flash video freezes in Firefox

Posted by sortofme on October 6th, 2008

So, it took me ages and I started living with this Bug, that I just couldn't play any flash videos through Firefox on neither my Windows XP nor Vista machines (slightly embarrassing for a flash developer). Googling the problem a couple of months ago, all results seemed slightly unsatisfactory. I re-googled, and now did find prper solutions. OK, the web might now offer them, although I thought one more Post about this won't harm. The best solution that did work instantly for me, is the one Mozilla offers on there site.

The main issue seems to be, that when updating to a new version (which I tried about 10 times), the old version actually does not really get deleted. Removing the flash-Player through the control panel is just a waste of time, but Adobe does offer an uninstaller, that works just fine.

Follow the instructions found on the above link, this has finally resolved the issue for me, and I don't need to open IE just for flash videos any more.

here a copy of the instruction from
Flash video (including YouTube) freezes in firefox

First try installing the latest version of Flash using this procedure to see if that helps:

1. Download this uninstaller from Adobe.com
2. Download this installer from Adobe.com
3. Close Firefox
4. Run the uninstaller, then the installer
5. Open Firefox

tha worked for me. Amen

debug snippet to check whether the client is local or online

Posted by sortofme on September 26th, 2008

often you need different settings whether you are working within your IDE environment during development, or when the swf is actually put LIVE. I have tried many variants of passing DEBUG=true or similar, but found that this one is the most elegant one:

Actionscript:
  1. //checking whther client is online or within IDE
  2.             if(stage.loaderInfo.url.indexOf("file:") != -1){
  3.                 trace("Lokal");
  4.                 _debug = true;
  5.             }else {
  6.                 trace("Server");
  7.                 _debug = false;
  8.             }

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