New Adobe Browserlab

June 3rd, 2009

A new way to test your web project using cross browser and operating system is Browserlab by Adobe.  Now you can put your project URL and see full page using a lot browsers with Windows, Mac OS, Linux and others.

If you alread have the Adobe ID you may go to Adobe Browserlab – link bellow – make login and use this new feature by Adobe, its fine to do. Try you too.

Link: Adobe Browserlab

Hi again, i update my scrollbar AS3 Class, named scrollbase, and today i post it for download, it’s really ease to work and so smaller than past version, only 1.5 kb.

The Features:
• Small file size
• Ease effect (or not) when move content
• Click the scroll background to move
•  Full customizable
• Scroll dragger with dynamic size
• All in one line

Download the Scrollbase sample and independent class (2227)

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

To use it you can write only two lines, so easy. The first line is the import and the second line is the scrollbase constructor, you need only put inside the constructor basicaly four movieclips, like show the sequence: content movieclip, mask of the content movieclip, the dragger movieclip and last movieclip is the background of the dragger, where the dragger will slide. Show the sample code bellow:

import com.dLibs.utils.scrollbase;
var sb:scrollbase = new scrollbase(conteudo,mascara,dragger,background,5,30);

This code show that ‘conteudo’ is the content movieclip and will be mask for ‘mascara’. ‘dragger’ is the movieclip that you click and move to see the rest of the content and move this movieclip upper of  ’background’ movieclip. So easy, but there we have some more arguments.

The fiveth argument is the Ease speed, you can change for more or less ease effect, by default the ease uint is 1 (one). The sixth argument is the bottom padding, you can put a number in pixels to show after the content movieclip, so much good for full background scrollbar, by default this padding is 0 (zero).

When you need you can verify if the scrollbase is necessary using the public function verifyHeight(). You can change the content of the moviclip and verify if content movieclip have the height propertie bigger than your mask. Usage:

import com.dLibs.utils.scrollbase;
var sb:scrollbase = new scrollbase(conteudo,mascara,dragger,background,5,30);
sb.verifyHeight();

You can download and change if you need. Try it!

Download the Scrollbase sample and independent class (2227)

Creative Commons License
Scrollbase by Scrollbar for AS3 is licensed under a Creative Commons Attribution 3.0 United States License.
Based on a work at code.google.com.

26 July ’09 /EDIT —————————–

I’m working in a new version of scrollbase and as soon as possible i will post here the classe code and samples, now im working with a temp class named scrollbasic that i made to resolve the problem that @sonia said in comment. You can download the scrollbasic with link bellow and as so simple to use like scrollbase:

import com.dLibs.utils.scrollbasic;
var nsc:scrollbasic = new scrollbasic(DataRecord.getDocumentClass, conteudo, mascara, sdragger, sbground);

Need set the main document class, you can create one static class to set and get it, and set the movieclips as content clip, mask clip, dragger clip and scrollbar background. Probabily i will post the new version of scrollbase 31 July ’09.

Thanks for all and sorry for the error.
: )

Download: Scrollbasic - Temporary Scrollbar Class (603)

Flex now is Flash Builder

May 18th, 2009

Yes, Flex Builder now is named Flash Builder and will be the Flash Platform Coder for Actionscript inside the Adobe Creative Suite CS5. Lee Brimelow write in your blog, The Flash Blog:

We at Adobe expected that the renaming of Flex Builder to Flash Builder would cause quite a bit of conversation in the community and indeed it has. After waking up this morning and reading all the reactions on various blogs and on Twitter, I feel like I need to answer some of the questions and concerns people have.

There you can see some answer for these questions:

• Are you planning on phasing out the Flash IDE?
• Isn’t it going to be more confusing when talking with clients about Flex?
• This screws up my resume and will make job interviews confusing won’t it?
• Will Flash Builder still be based on Eclipse?
• What about the Flex SDK?

Link: Flash Builder rebrand FAQ

XML and AS3 for beginners

May 15th, 2009

Hi guys, now we say something about how load and use the XML file as data base inside the Flash project using Actionscript 3.

First we need load the XML file to read these data inside the Flash. To do it create first a variable of URLLoader and other URLRequest. Different that when we load images, here need use the URLLoader() and not the Loader() class. Go to the first step:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package
{
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
 
	public class loadXML
	{
		private var xmlLoader:URLLoader;
		private var xmlRequest:URLRequest;
		private var newXML:XML;
 
		public function loadXML():void
		{
			xmlLoader 	= new URLLoader();
			xmlRequest 	= new URLRequest("dataXML.xml");
			xmlLoader.load(xmlRequest);
			xmlLoader.addEventListener(Event.COMPLETE, dataLoaded);
		}
 
		public function dataLoaded(e:Event):void
		{
			newXML = new XML(e.target.data);
			trace(newXML);
		}
	} // End Class
} // End Package

The sample code will load the XML using URLLoader and using the URLRequest, inside the URLRequest you will put the XML file address. After that may create the Listener to say when XML file is loaded or loading or all that happened.

Inside the dataLoaded() function you will see that the newXML:XML() receiving the loaded data and creating your new XML file. Yes, now we can use the data to put inside the project, well lets go to the second step, first see the XML file:

1
2
3
4
5
6
< ?xml version="1.0" encoding="utf-8"?>
<gallery title="Gallery Name" author="Author Name">
	<picture title="title of the first picture">/images/files/001.jpg</picture>
	<picture title="title of the second picture">/images/files/002.jpg</picture>
	<picture title="title of the last picture">/images/files/003.jpg</picture>
</gallery>

This time we have all the xml data inside the newXML() variable, to use these data it’s so simple, first we need to think that the first tag of the XML file is our newXML variable, if we call the newXML.@title will retrieve the title of the gallery tag. The same can do it to retrieve the author parameter value.

Well, if you retrieve the data from the gallery tag the rest is so easy. Let’s now retrieve the picture value, see the sample inside the dataLoaded() function:

24
25
26
27
28
29
public function dataLoaded(e:Event):void
{
	newXML = new XML(e.target.data);
	trace(newXML.picture[0].text()); // result : /images/files/001.jpg
	trace(newXML.picture[0].@ title); // result : title of the first picture
}

Or you can take the picture tag number and make a loop with these data, to get the picture quantity you need only get the array lenght():

26
27
var newXMLQnt:uint = newXML.picture.length();
trace(newXMLQnt); // result : 3

Now you can create your own code using the sample codes, it’s so easy to do it, load and use the XML data inside the Flash using Actionscript 3. Try it and if have some difficulties comment here. Thanks for read and Cya.

Hi for all, today i will explane something about the principiles of Actionscript 3: how to load an image inside the Flash. For totaly beginners, it’s so simple do it.

What the difference when load a picture using Actionscript 2 or 3?
Well, on AS2 you can call the file and imediatly when it loaded will appear inside the moviclip or stage. Using AS3 you can choice when and where the loaded file will appear.

AS3 Loader: your first loader inside Flash CS4
You need the Loader object and too create the listeners that will say for you what’s happen, if is loading, was an error or if the file is completely loaded. These listeners will be necessary always when you call a image or a XML file and others. Well, go to the Loader: see the code bellow:

1
2
3
4
5
6
7
8
9
10
11
12
import flash.display.Loader;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
 
var request:URLRequest = new URLRequest("image.png");
var loader:Loader = new Loader();
     loader.load(request);
     loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingImage);
     loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadingError);
     loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingComplete);

Here i created some differents listeners for the loader, the first, ProgressEvent.PROGRESS, will call the function loadingImage alway when the image is loading, inside the loadingImage you can create your preloader function using loader, get the bytes loaded and bytes total using the ProgressEvent inside the called function, something like this:

15
16
17
18
19
20
21
var loaditPercent:uint;
 
private function loadingImage(p:ProgressEvent):void
{
	loaditPercent = Math.ceil( ( p.bytesLoaded / p.bytesTotal ) * 100 );
	trace(loaditPercent);
}

The loaditPercent will show us the percent loaded. If you try your code will see that the image is loaded because the trace will show you 100% loaded but the image dont appear, need create the loadingComplete function and inside it we will put the loaded file inside of some movieclip or add it on the stage, you choose:

25
26
27
28
29
function loadingComplete(e:Event):void
{
	// addChild(loader);
	addChild(e.currentTarget);
}

This will add the loader, the picture, on the stage. Change the location using the MovieClip instance befora the addChild function. You can use too the loadingError function for your custom loader error, it’s so easy like others. Try it, for support comment here. Thanks for read.

Hi again, sorry for the delay to write again. Here im Brazil, 1st May was a holly day and i was play with my son. Well here in agency we have some problens today with system memory of a AIR Project, the project play full HD videos and HD images into a 32″ LCD. 

The problem: When i load videos and pictures, so much pictures, inside the project using Loader Class the memory will be always growing and growing and this will close sometime the application.

Solution: Like the post title, Garbage Collector. Well, the Garbage collector is alway actived by Flash Player, when i unload the Loader it will be send to the “trash” of Flash Player, and Garbaga Collector will define when delete the “trash” content, but we can tell to the Garbage Collector that “trash”  is Ok to be deleted.

It’s so simple:

1
2
import flash.system.System;
System.gc();

If you have a custom loader class you can put the System.gc() into your unload public function to say to the Flash Player that the unloaded content it’s ok to be deleted.

1
2
3
4
5
6
7
import flash.system.System;
...
public function unloadcontent():void
{
	_yourCustomLoader.unLoad();
	System.gc();
}

To force the Flash Player delete the content more speedily you can make a loop with 10 times calling the Garbage Collector:

1
2
3
4
5
6
7
8
9
10
11
import flash.system.System;
...
public function unloadcontent():void
{
	_yourCustomLoader.unLoad();
	// Calling System Garbage Collector loop
	for ( var gci:uint = 0; gci < 10; gci++ )
	{
		System.gc();
	}
}

The loop will force the Flash Player delete the content and make your app don’t crash.
It’s really easy, yeah? Try it, comment and if i save your life buy me a beer using the donation block in right side. Thanks for reading again

First Anniversary of DES84 Blog

Today DES84 Blog make your first anniversary, with 4k access per Month and growing, 10k page views per month more than 200 comments and only 3 months in full english language. Today i need say “Thanks” for all comments, all access, download and so much more that makes me write one post per 3 days.

Congratulations for us.
Thanks

Hi again guys, im working hard with AIR projects and today i did one thing that i hate: use  always on top for one program, hehe. Well, was necessary because the project is a digital ad platform using one 32″ LCD with touchscreen and the user interact with the content.

Well, about the alway on top is so simple, first you may create one variable for your Native window.

1
var newWindow:NativeWindow = stage.NativeWindow;

After that you need put only the alwaysInFront and set it true like this.

2
newWindo.alwaysInFront = true;

aaaand done, try it.

Hi for all, stop to program using Actionscript 2 and, pleeeeeeeeeeeeeeeeeease, come to our team and lets play with Actionscript 3. If you want trade the AS2 for the AS3 don’t use AS2 to AS3 convertion, don’t create your project using AS2 and tell to your friend change it for AS3, do it yourself. Now you can only reading the Adobe Actionscript 3 Migration Cookbook.

Now with basics, user interaction, dynamic movieclips and how to use media and data. It’ so simple do it.
Try you too and be free of AS2. Go to the book with the bellow link.

Link: Actionscript 3 Migration Cookboot Beta

Hi again folks, today working with AIR application i was searching something about control the window and database using Flash CS4, but today i will talk about only window control, close, minimize and move application window, its so simple do it, basically you need import only NativeApplication class, see the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package
{
	import flash.desktop.NativeApplication;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
 
	public class DocumentClass extends MovieClip
	{
		public var closeBt				:MovieClip;
		public var minBt				:MovieClip;
		public var recordBox			:MovieClip;
 
		public function DocumentClass():void
		{
			closeBt.addEventListener(MouseEvent.CLICK, closeApp);
			minBt.addEventListener(MouseEvent.CLICK, minApp);
			recordBox.addEventListener(MouseEvent.MOUSE_DOWN, dragApp);
		}
	}
}

We have now three functions: closeApp, minApp and dragApp. Three simple steps to take the window control, lets start with dragApp, the function that will drag your AIR Application using MOUSE_DOWN event.

Now we need put this private function inside the document class, bellow the code:

20
21
22
23
private function dragApp(m:MouseEvent):void
{
	stage.nativeWindow.startMove();
}

The function will work only when mouse is down in the recordBox Movieclip, now you can drag your application using mouse moviment. Now to close and minimize the application you will use a simple CLICK event.

25
26
27
28
29
30
31
32
33
private function closeApp(m:MouseEvent):void
{
	NativeApplication.nativeApplication.exit(); 
}
 
private function minApp(m:MouseEvent):void
{
	stage.nativeWindow.minimize();
}

To close the application using Flash CS4 you need use the NativeApplication and not only NativeWindow. But is so easy to use and now you can create your AIR application using a custom chrome. Try it!