Look Something





Cari Uang Di Internet Dengan Cara Mudah....
SilahKan Click Disini

Sabtu, 03 Januari 2009
Buiding a Video Player Application in Flash CS3 Flash Tutorial

1

Start with a new Actionscipt 3 document. Create or import your art.

Open the components panel. Create a new layer an call it vid. Drag a copy of the FLVPlayback component to the stage. This is where the video will show.

Flash Video player

2

Set the size and give it an instance name, so we can target it with action script. In this case the name is vidPlayer.

Flash Video player

2


Now we need to create some buttons to control the video playback.
Use the Button components in Flash, create your own buttons or create hotspots to make parts of your page visible. Hotspots are created using the “Invisible button trick.”


Create a layer named buttons. Using the drawing tools in Flash, create the shape that you want to use for your button.
Press F8 to convert to Symbol. Choose Button.Flash Video player

3


Double click the button on the stage to edit the symbol.
You will see a solid square on Up. Drag this to Hit. The button will now have a clickable area only.

4


Click Scene 1 to go back to the stage.
You will see that the button displays as a cyan colored shape. This is for reference only, the color will not be visible in the published movie.
Make copies of the buton, position and size to suit your needs. Click each button and assign an instance name. For this example I’ve used btn1, btn2 and btn3.

Flash Video player
Save the file into the same folder as your video clips (FLV or H264 video).
Now it’s time to write the code that makes all this work. We will not be selecting the movies from the Component Inspector, we will be attaching them dynamically so they are called by the buttons.

5


Create a new layer, name it “actions”. Open the Actions panel. Type this code:


btn1.addEventListener(MouseEvent.CLICK, vid1);
btn2.addEventListener(MouseEvent.CLICK, vid2);
btn3.addEventListener(MouseEvent.CLICK, vid3);

function vid1(e:Event):void{
vidPlayer.source = "boat.flv"
};
function vid2(e:Event):void{
vidPlayer.source = "dance short.flv"
};

function vid3(e:Event):void{
vidPlayer.source = "wheel.flv"
};

Test the movie and it should now work.

Let me explain the code:

The code is broken into 2 parts in Actionscript 3.

1. The Event Handler or "trigger" In this case its the buttons.

btn1.addEventListener(MouseEvent.CLICK, vid1);

The button which has the instance name, btn is waiting for something to happen. The EventListener is listening for something to happen. It's waiting fo an event. In this case the event is a mouse event. The type of mouse event the listener is expecting is a CLICK.

Only when the Button detects a mouse click will it proceed. When it proceeds its sends a message to a function. The name of the function is after the comma. In this case it's vid1.

2. The Function which contains the event (Something happens: Video plays).

function vid1(e:Event):void{
vidPlayer.source = "boat.flv"
};

In this case a function named vid1 will perform when it receives a command to run. (This command will come from the event handler: the button.)

The vidPlayer component is now targeted. Source sets the path to the video. In this case its boat.flv (Must be an flv or H.264 Quicktime movie). The video will play automatically when its connected to the component.

6

Publish the page by choosing Edit Publish settings. Choose the formats tab and check html and swf.
Click Publish and you’ll have a new HTML document with your movie ready to go.
When you upload it make sure to include the swf (Container) html, and movie files. If you used a playerskin, include that swf too.

Label:

posted by Make Some Better @ Sabtu, Januari 03, 2009  
0 Comments:
Posting Komentar
<< Home
 
Clock


Semarang Weather
Search
Google




Send a Greeting Card
Retrieving an E-Card?
Enter Card Pick-up ID below:
Get your Free E-cards
by bravenet.com
About Me

Name: Make Some Better
Home: Semarang, Indonesia, Indonesia
About Me: Manusia Hanya Bisa Berdoa dan Berusaha Namun Allah SWT yang menentukan
See my complete profile
Previous Post
Archives
Shoutbox

Page Rank
Visitor
Blog Bookmarks
oggix.com : <a href=http://oggix.com> Free Shoutbox & Complete Blog Tools</a>
Blog Bookmarks
Counter
Banner


KapanLagi.com Game



KapanLagi.com Face



KapanLagi.com



KapanLagi.com Image Hosting



KapanLagi.com Clubbing



KapanLagi.com Trailer


My Friends Banner

tutorial photoshop





Musik-Bank

pulsa murah
Powered by

BLOGGER

Free Shoutbox Technology Pioneer