Search posterous

Search all posts and users. Type a name, type a favorite song title, whatever! See what comes up.
  

More posterous blogs











More recommended blogs »

Here are posterous posts filed under as3...

sharathciddu says...

Singleton classes are one of the simple but very effective design patterns. Creating singleton classes in Java, C++ or even AS2 for that matter is very straightforward.

But in AS3, which is based on ECMAScript private constructors are not supported. The following is how you enforce a user of your library to have a singleton object in AS3.

Even the SingletonEnforcer class should go into the Example.as

package com.ciddu.sharath

{

     public class Example

     {

           private static var _instance:Example;

           public function Example(obj:Singleton)

           {

                if(obj == null)

                {

                     throw Error(“This is a singleton class. Use getInstance instead”);

                }

           }

          

           public function getInstance():Example

           {

                if(Example._instance == null)

                {

                     var obj:SingletonEnforcer = new SingletonEnforcer();

                     Example._instance = new Example(obj);

                }

                return Example. _instance;

           }

     }

}

class SingletonEnforcer

{

}

Since the class SingletonEnforcer is present outside the package, it is not accessible outside Example.as

But at the same time if someone tries to create an object using new Example(), it will throw argument mismatch error during compilation.

If still someone tries to use new Example(null), a runtime exception is thrown.

Filed under: as3

SOLO - Music Website Template - with deeplinking
Featuring deep-linking, url error management, playlist maker and integrated twitter reader. Designed with a musician in mind but equally suitable for any artist.

Filed under: as3

jotarun says...

What we need is a event driven function that stop the film at the final frame:

function playonce(event:Event):void

{
   var target:MovieClip = event.target as MovieClip;
    if (target.currentFrame==target.totalFrames) // or anywhere you want to stop
      target.stop();
    }

 

Now, simply add an listener to the movie after play() /gotoandplay()

movieclip1.play();
movieclip1.addEventListener(Event.ENTER_FRAME,playonce);

 

Filed under: as3

Tikin says...

Asual | Blog - SWFAddress 2.4
http://www.asual.com/blog/swfaddress/?permalink=swfaddress-24.html

Filed under: AS3

chrisdasie says...

I've been finding lately that, I'm having less and less need for actionscript and flash based sites. Why is this you might ask? Well, since learning ajax, javascript and of course the jQuery library, I find that i'm able to get the same results as I would with tweens and transitions but with less of the headaches. Have we come so far that actionscript is becoming an obsolete language? Maybe, maybe not. To my knowledge, you still have create 3D movements (like papervision) with jQuery or other javascript libraries. Maybe I'm wrong and would love to find out that I am.

The other reason I see less need for Actionscript is that it is still miles behind in its ability to be tracked probably. Yes Google Analytics has come out with some great components to add to your flash site in order to track users and user interactions, but the headaches that come with setting it up without destroying the rest of your code is sometimes not worth the effort. I was doing this the other day on a recent project. The client has requested we build them a flash based site, unfortunately we didn't ask them if they wanted to be able to track the information on user interactions with this site. Once the site had been launched that was the first thing they asked for. But because we had finished testing and building the site, the implementation of each clicked section became more than we could handle for the given timeline so I had to leave it as a general overview version.

My current portfolio is flash based and I sat and wondered this over the past weekend, why I was keeping it that way? I haven't given myself a good reason and will probably begin a redesign of it soon. I think the extent of which flash is being used is diminishing much like traditional media budgets. But we as designers have to be careful because there are still millions of users out there that still are using IE6 (which I don't endorse what so ever) and also don't have javascript enabled. These can definitely cause a whole new set of headaches to watch out for. I still think unless something amazing happens within the next few years in the world of actionscript that we will see it be reduced down to display banners and landing page sites that only have a single page use for entertainment value only. The strength and unlimited possibilities that Ajax and jQuery present out weigh the need to fully utilize Actionscript any more.

Filed under: AS3

To avoid charset issues when pulling from a MySQL database using AMFPHP:

1. Find the line in your gateway.php where the setCharsetHandler is set.

2.  Modify the default to:

 $gateway->setCharsetHandler("mbstring","UTF-8","UTF-8"); 


This setting worked best for me, but for more in depth info, check out:

http://www.sephiroth.it/tutorials/flashPHP/amfphp_iconv/page003.php

Filed under: as3

In an attempt to save you hours of painful debugging and Adobe-hating: if you're wanting to use the excellent AS3 bulk-loader lib to load assets from S3, follow these steps.  Especially step 2.

1. Put your normal crossdomain.xml in place in your S3 bucket

2. Use a loader context on every BulkLoader !

 var context:LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain); 
 var loader:BulkLoader = new BulkLoader("loadmystuffplskthxbye");
 loader.add( someS3Url, { context: context  } ); // WIN 



reference: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=2011

 

Filed under: as3

individual11 says...

(download)

So this is the first run at porting over my old as2 particle system to as3. I added a little "z" action to get the 2.5d stuff. Use a vector array to keep track of everything. Instantly got 3 times the particles (1500 now) with the same speed. If I didn't have the z stuff in it, was able to get over 5000, but it was a mess in a 400x400 viewing area.

Will keep messing around with it, and will post some more stuff for it later.

Filed under: AS3

individual11 says...

Just ported over my old as2 particle system to as3, and added a little bitmap data object to make trails of where they go. Besides crashing Flash (I'm working on that), the results were kind of cool.. here are a couple screen grabs. Will post a working swf in a couple minutes after I clean it up a bit.

       
Click here to download:
Particles_in_3d.zip (1293 KB)

Filed under: AS3

individual11 says...

Will post the code/video or something of the experiment I'm building out, but for now, here a cool intro to working with it from Adobe.tv

Update: ok, so adobe tv sucks because the link won't work, and the embed auto plays.. so here is the site to get you started ->http://wiiflash.bytearray.org

Filed under: AS3