Documenting your classes with ASDoc in a MAC

After following different tutorials of how to run ASDoc on your computer and failing I finally was able to figure out a way to have it running with almost no issues at all, so I thought I would share my steps here for those of you still struggling with he situation.

1. First and most important install ANT on your computer.
(a) Download ANT and you can follow the command line instructions if you have Admin rights on your computer but if you don’t have admin rights then you can follow these steps.
(i) After you download ANT and you have UNZIP the files open /user/local/ with a text editor that allows you to browse hidden or locked files (I used TextMate by creating a new project).
(ii) After you open the folder with your text editor, if you have the choice do a file.open source (in my case with TextMate I just right click the folder and did a “Reveal in Finder”).
(iii) Dump your Unzipped files in the /user/local/ folder and now you should have something like /user/local/apache-ant.
(iv) Set a Permanent aliases for ant (another tutorial for those who do not know how to do this)
2. Download the Free Flex SDK ( At the time of this writing I used Flex3SDK Beta).
3. Place the FLEX SDK anywhere in your machine (in my case I used Applications/FLEX).
4. This step is option since you can set a permanent alias for FLEX or in my case since for some reason my aliases didn’t work properly for FLEX so I just declared where the asdoc was located in my build.xml

Thats it, now to test this just run a build.xml and if everything is installed properly you should be able to have beautiful documents created by ASDoc.

Here is a Build.xml sample:

[php]
< ?xml version="1.0" encoding="utf-8"?>















[/php]

Continue reading Documenting your classes with ASDoc in a MAC

Stop sound of loaded SWFs in AS3

Until now I didn’t have any issue when removing an item from the display list until the item had sound in it. This has to do with an application I am working on which loads several SWFs and they have to be turned “on” and “off”. When the SWF has to be turned off the sound has to go with it. So having the item be removed from the DisplayList was the first “answer”, but of course if every listener has to be removed from any item that is being removed from the DisplayList the sound object is not an exception. But how do you do that? Again the first logic was to add a new Sound object to the loaded SWF and then control the sound in that way but that didn’t fly. Looking in the docs with more detail we find the SoundTransform and here is a description “The SoundTransform class contains properties for volume and panning. The following objects contain a soundTransform property, the value of which is a SoundTransform object: Microphone, NetStream, SimpleButton, SoundChannel, SoundMixer, and Sprite”

So with that knowledge in mind now we can control the sound of the loaded SWF’s and here is a sample of what I was working with.

[as]
package {

import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.*;
import flash.net.*;
import flash.display.Loader;
import flash.utils.Timer;
import flash.media.SoundTransform;

public class SoundStopTest extends Sprite {

var loader1:Loader;
var loader2:Loader;

var mc1 : MovieClip;
var mc2 : MovieClip;

var holder:Sprite;

var mySoundTransform:SoundTransform

public function SoundStopTest() {

holder = new Sprite;

var url1:URLRequest=new URLRequest(“scene6_portofino.swf”);
var url2:URLRequest = new URLRequest(“scene6_royalpacific.swf”);

loader1=new Loader();
loader1.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader1.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader1.load(url1);

loader2 = new Loader();
loader2.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler2);
loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader2.load(url2);

holder.addChild(loader1);
holder.addChild(loader2);

addChild(holder);

var myTimer = new Timer(2500, 1)
myTimer.addEventListener(“timer”, theEvent)
myTimer.start();

var myTimer2 = new Timer(2500, 1)
myTimer2.addEventListener(“timer”, theEvent2)
myTimer2.start();
}

private function completeHandler (e:Event ) {
mc1 = MovieClip(loader1.content);
mc1.gotoAndPlay(2);
}

private function completeHandler2 (e:Event ) {
mc2 = MovieClip(loader2.content);
mc2.gotoAndPlay(2);
}

private function theEvent(e:TimerEvent) {
mySoundTransform = new SoundTransform();
mute();
}

private function theEvent2(e:TimerEvent) {
// holder.removeChild(loader1); Uncomment if you want control of one item instead of all
// holder.removeChild(loader2); Uncomment if you want control of one item instead of all
removeChild(holder);
}

function mute():void {
mySoundTransform.volume = 0;
// mc1.soundTransform = mySoundTransform; Uncomment if you want control of one item instead of all
// mc2.soundTransform = mySoundTransform; Uncomment if you want control of one item instead of all
holder.soundTransform = mySoundTransform;
}

private function ioErrorHandler(event:IOErrorEvent):void { }

}
}

[/as]

One thing that you will notice is that I muted two movies at once by adding two movies into one item and then controlling the volume of that single item. The reason why am I doing it this way is because I need control of one movie at the time as also control of all movies together.

Another thing you will notice is a Timer Event, that was just added to enhance my testing but doesn’t have to be used in this way.

Continue reading Stop sound of loaded SWFs in AS3