February 2010
M T W T F S S
« Jan   Mar »
1234567
891011121314
15161718192021
22232425262728

FlashDevelop Themes

Theme 1

Instruction:
1. Download Theme 1
2. Extract files from downloaded .zip file.
3. Find there AS3.xml
4. Open FlashDevelop, on top menu click Tools>Application Files>go to Settings folder>go to Languages folder
5. Change existing AS3.xml to your downloaded AS3.xml file (you can save existing AS3.xml file somewhere if you will not like new scheme you can come back old [...]

HighlightSelection plugin for FlashDevelop

HighlightSelection plugin to highlight all words matching your selection. For example if you want hightlight all ‘function’ words you need double click to ‘function’ word.

You can download HighlightSelection plugin, extract to your pc and put .dll to C:\Program Files\FlashDevelop\Plugins.

I find this plugin here.

QuickNavigate plugin for FlashDevelop

Instruction:
1. Please download QuickNavigate plugin.
2. Extract files.
3. Copy QuickNavigate.dll to C:\Program Files\FlashDevelop\Plugins
4. Restart your FlashDevelop

What you can do with this plugin:
1. Quick open file (Ctrl+R)

- searching files through all source paths
- doesn’t show files in .svn, .cvs, .git folders
- searching by abbreviation (type “FC” for find FooCommand)

2. Quick outline (Ctrl+Shift+O)
- quick search member/method in [...]

Folding plugin for FlashDevelop

Please read more about folding first.

Download plugins for folding:
Fold

Instruction how to add this plugin:
1. Please download Fold 0.2 to your PC.
2. Extract files.
3. Copy Fold.dll to C:\Program Files\FlashDevelop\Plugins

4. Restart or open FlashDevelop
5. Open your .as file and try to enter Alt+1, Alt+2, Alt+3, Alt+4 etc.. and you will see how folding your code. Please see [...]

How comment code in FlashDevelop

Everyone use symbols ( /* code here */ ) and ( //code here ) to comment your code. But how to do it in FlashDevelop?

If you want use line comment pls do this:
1. You can select line or just put cursor to this line and enter Ctrl+q on your keyboart and you line code will [...]

How to play/stop sound & control volume

Problem
Need to control sound with a play button, stop button, volume up and volume down.

Solution
Use SoundChannel and SoundTransform.

Detailed explanation

var req:URLRequest=new URLRequest(”sound.mp3″);
var mySound:Sound=new Sound;
var myController:SoundChannel;
var myVolumeControl:SoundTransform;

mySound.load(req);

mySound.addEventListener(Event.COMPLETE, mySoundLoaded);

function mySoundLoaded(event:Event):void {
myController=mySound.play();
myController.stop();
myVolumeControl=myController.soundTransform;

play_btn.addEventListener(MouseEvent.CLICK, playMySound);
stop_btn.addEventListener(MouseEvent.CLICK, stopMySound);
upVolume_btn.addEventListener(MouseEvent.CLICK, volumeUp);
[...]

How to create a preloader

Problem
Need to create a preloader

Solution
Using Math.round(event.bytesLoaded / event.bytesTotal *100);

Detailed explanation

var req:URLRequest=new URLRequest(”img.swf”);
var myLoader:Loader=new Loader ;

function imgFileLoaded(event:Event):void {
addChild(myLoader);
}

function preloader(event:ProgressEvent):void {
var percentage:Number=Math.round(event.bytesLoaded /
event.bytesTotal *100);
preloader_txt.text=String(percentage) + “%”;
}

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
imgFileLoaded);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
preloader);

myLoader.load(req);

Source:
Creating_a_preloader

Loading Bitmap to the stage

Problem
Need to load an image to the stage

Solution
Use URLRequest, Loader and addChild.

Detailed explanation

var req:URLRequest = new URLRequest(”dog.png”);
var myLoader:Loader = new Loader();

myLoader.load(req);
addChild(myLoader);

Thank you for reading, source you can find in attached file.

Source:
Loading_bitmap

Play/Stop Sound

Problem
Start and Stop sound with buttons.

Solution
Using URLRequest and events

Detailed explanation

var req:URLRequest=new URLRequest(”sound.mp3″);
var mySound:Sound=new Sound ;
var myController:SoundChannel;
mySound.load(req);
mySound.addEventListener(Event.COMPLETE, mySoundLoaded);

function mySoundLoaded(event:Event):void {
play_btn.addEventListener(MouseEvent.CLICK, playMySound);
stop_btn.addEventListener(MouseEvent.CLICK, stopMySound);
}

function playMySound(event:MouseEvent):void {
myController=mySound.play();
}

function stopMySound(event:MouseEvent):void {
myController.stop();
}

Source:
play_stop_sound

Delay an ivent

Problem
Hide a MovieClip after 2 seconds

Solution
Using setTimeout function.

Detailed explanation

my_btn.useHandCursor=true;
function hideBall() {
my_mc.visible=false;
}

my_btn.addEventListener(MouseEvent.CLICK, deleteBall);
function deleteBall(event:MouseEvent):void {
setTimeout(hideBall, 2000);

}

Source:
delay