Flash Video Player

Sometimes happen to have to print the contents of our SWF in paper or PDF.

The right Actionscript 3.0 class to do that is is the PrintJob!

It happened just yesterday to me with a client who I made a small application.

This application displays images with descriptions and the client has asked me to add an option, which allowed the user to print on paper or PDF ( if

he has Adobe Acrobat Pro ) image and description.

Because I felt it could serve others, I public a simple tutorial on how to use PrintJob class of Actionscript 3.0.

Unfortunately, this class has a bug ( https: / / bugs.adobe.com/jira/browse/FP-307 ) if used on MAC.

It works only locally, on the Web does not work.

Do your tests and keep track of your results!

Create a FLA and save it as name “main.fla”.

Read more

Share This Post Tags: , ,

Related posts

{ 0 comments }

Suppose you have an Array of data and that we want eliminate the elements that have the same value.

For example, we got from a DataBase the data on sales of some products.
These products are different from each other and the customer asks us to create a scroll that displays product filter.
To do this we must create a function that controls which elements of the Array are equal and how many times are present.

In practice we get a "pure" Array without double values.

Who works with mySQL know who could do well with a query, but we need to do it with Actionscript!

How?

I have this array of values that contains ID recovered from products sold DataBase

1
var my_array:Array=new Array(45,23,23,3,76,5,3,23,5,8,8,8,8,12,12,3,4,9,10,12,13,19,23,5,6,2,2,2,2);

I create the following function

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function getUniqueValues(originalArray:Array):Array
{
	var lookup:Array=new Array();
	var uniqueArr:Array=new Array();
	var num:int;
	for(var idx:int=0;idx < originalArray.length;idx++)
	{
		num=originalArray[idx];
		if(!lookup[num])
		{
			var obj:Object=new Object();
			obj.id=num;
			obj.count=0;
			uniqueArr.push(obj);
			lookup[num]=true;
		}
	}
	return(uniqueArr);
}

that returns a new Array with unique elements.

[click to continue…]

Share This Post Tags: ,

Related posts

{ 0 comments }

FlepStudio has created a new free Flash CS3 utility.

It’s a simple “ Tell A Friend ” that allows you to recommend a url to friends of your users.

The utility sends an e-mail with the name of user to his friend and will contain the url of the page where SWF is located and then warn the recipient of the mail going to that url as recommended.

For example, if you have a blog , just embed this SWF to any article.

Let’s try it…

Read more

Share This Post Tags: ,

Related posts

{ 0 comments }

Zend is a PHP framework.

Zend Amf permits communications between Flash and PHP without using XML.

For example, to query a DataBase by Flash we need to call a PHP script that executes the query at DB and returns an XML output.

At that point only Flash can display the data it got from DB.

We bypass XML by using Zend instead !

In this case PHP executes the query at DB and it returns the values ( i.e. an Array ) to Flash directly.

How ?

Using the NetConnection class of Actionscript 3.0 !

This tutorial will show a brief sample on how to query a DataBase with Actionscript 3.0 and Zend.

We can use both Flash CS3 or Flash CS4.

Step 1

Download Zend framework ( ZIP version 1.7.0 ).

Requirements:

- PHP 5.1.4 or more

Read more

Share This Post Tags: ,

Related posts

{ 0 comments }

Brief Introduction to Flash CS4

by admin on November 9, 2008 · 0 comments

in Flash CS4 news, News

It’s a couple of days I’m using Flash CS4 and then I express here my first words.
I state that my MAC OS is Leopard.

The first thing that jumps to my eyes is the new Adobe style interface, it seems to work with Photoshop.
While Flash CS3 had some Macromedia style, Flash CS4 has panels and colors typically Adobe.

Select and drag panels are much more fluid and natural.
Highly customizable interface.

I really appreciate the new dragging system to change numeric values:

During Adobe Extension Manager installation it has imported automatically all my components I had in pevious version.

I also have to say I do not like the new Help system. It does not reside anymore in local but it is on Adobe website only.
Crap…this is so slowly for consulting.

New built-in components ? No one ( sad ).

Possibility to work with Actionscript 2.0 and of course Actionscript 3.0 .
Also we can save FLA files for CS3 version but not for Flash 8 and previous versions.

Built-in templates have remained Advertising only.

About Tweens and animations on the timeline, Flash CS4 goes certainly a step forward.
Indeed, the Motion Editor and the new Timeline is certainly substantial differences that stand out compared to version CS3.

A Flash Designer will certanly appreciate these new features.

Stay tuned because it will fine!

Share This Post Tags: , ,

Related posts

{ 0 comments }

When a bitmap (image) is reduced by using the methods scaleX and scaleY or width and height, the same bitmap seems to have changed but the size really does not.
This is because the BitmapData of the image has remained the same, then the weight and memory are same even if we had scaled down the image to 10%.

To resize and then actually gain weight and memory we must use the draw method of BitmapData class (of which we have already seen an example) and the Matrix class.

Very useful to create thumbnails.

The steps are as follows:

  1. Retrieve a temporary reference to the original Bitmapdata object.
  2. Draw a scaled version of the original BitmapData object into a new BitmapData object.
  3. Associate the original Bitmap object with the new, scaled Bimapdata object.

Here is the code:

1
2
3
4
5
6
7
8
9
var originalBitmapData:BitmapData=originalBitmap.bitmapData;
var scaleFactor:Number=0.5;
var newWidth:Number=originalBitmapData.width*scaleFactor;
var newHeight:Number=originalBitmapData.height*scaleFactor;
var scaledBitmapData:BitmapData=new BitmapData(newWidth,newHeight,true,0xFFFFFFFF);
var scaleMatrix:Matrix=new Matrix();
scaleMatrix.scale(scaleFactor,scaleFactor);
scaledBitmapData.draw(originalBitmapData,scaleMatrix);
originalBitmap.bitmapData=scaledBitmapData;
Share This Post Tags: , , ,

Related posts

{ 0 comments }

Sometime we need to get the url of the web page where our SWF is located.
Actionscript 3.0 gives us a way to do it just using 1 line code.
Just use ExternalInterface class that runs a Javascript command and gets the page’s url.

Here is the code:

1
2
var pageURL:String=ExternalInterface.call('window.location.href.toString');
trace(pageURL);

DEMO

In that case I called the property href of Javascript Location class using Actionscript.
Javascript Location class has its properties so I used hostname, pathname and protocol too.

Also I got data of the user’s browser using the Navigator class of Javascript with its properties userAgent and platform.
hurray
All this with Actionscript 3 !

1
2
3
4
5
6
7
8
9
10
11
12
var pageURL:String=ExternalInterface.call('window.location.href.toString');
var pageHost:String=ExternalInterface.call('window.location.hostname.toString');
var pagePath:String=ExternalInterface.call('window.location.pathname.toString');
var pageProtocol:String=ExternalInterface.call('window.location.protocol.toString');
var userAgent:String=ExternalInterface.call('window.navigator.userAgent.toString');
var platform:String=ExternalInterface.call('window.navigator.platform.toString');
 
url_txt.text=pageURL;
hostname_txt.text=pageHost;
path_txt.text=pagePath;
protocol_txt.text=pageProtocol;
browser_txt.text=userAgent+"\n"+platform;

Share This Post Tags: , ,

Related posts

{ 0 comments }

Winners?
Yeah, you read that right!

Cause the large participation, JumpeyeComponents decided to give an extra FlashEff.
Then, roller drums … the winners of the component are:

  • Comment 35
    wrote by Joe Fraga
    cool component for easy tweening :)
  • Comment 164
    wrote by David Bernad
    I like Flash CS3 very much.
    I want the component!!

Congratulations !

The winners were contacted by FlepStudio with appropriate instructions.

Stay tuned !

Share This Post Tags: , ,

Related posts

{ 0 comments }

Once again, JumpeyeComponents offers an excellent chance to win a great component for Flash CS3-CS4.


The component is FlashEff.

With this excellent tool we can animate any object in Flash, MovieClip, Text Fields and images.

We can create animated buttons with cool effects in a few simple steps.

Apply static or animated filters to any object and much more…

For those who do not know is also available a free basic version, downloadable at FlashEff’s free downloads .

You also may want to check the FlepStudio’s review of FlashEff component: FlashEff review.

Also, have a look to official video tutorials of the component: FlashEff VideoTutorials.

Which target / level users are directed?

Certainly for beginners who want to get impressive effects and outside the town without using Actionscript or interpolations on the timeline.

But they are good even for advanced users that require a quick tool in order to save valuable time in creating effects and beyond.

How to win this component ?

Super easy… Just leave a comment in this article and Wednesday, November 5 2008, FlepStudio will draw a random comment.

The comment’ s author will win the component.

Of course, when you write the comment, fill out the field in which it requested the e-mail address so that you can confirm yourself as author of the message in case of winning.

Good Luck !

Share This Post Tags: , ,

Related posts

{ 172 comments }


Who uses Flash to create Web sites knows that the contact form (form of sending email) is one of the most used up.
I received many e-mails by users who demanded a tutorial explaining how to build one.
What I will explain then describes step by step how to create a basic form of sending email using Actionscript 3.0 and PHP.

Step 1 - Create FLA and Document Class

Create a FLA file and save it as name “main.fla.”
Create the Document Class, an AS file named “Main.as”, implemented in this way

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package
{
	import flash.display.*;
	import flash.events.*;
 
	public class Main extends MovieClip
	{
		public function Main()
		{
			addEventListener(Event.ADDED_TO_STAGE,init);
		}
 
		private function init(evt:Event):void
		{
			removeEventListener(Event.ADDED_TO_STAGE,init);
 
			trace("My Document Class has been created correctly");
		}
	}
}

Read more

Share This Post Tags: ,

Related posts

{ 0 comments }