He'll
be keeping you up to date with all the latest news and developments
from the world of technology!
Where
to buy...
Forums
PC
broke? Need help building a web site? Want to know what the
best spec PC is for your budget? Join our on-line community
for all the answers! Click
here
What
happened...
..to
[.tv]? They went to the big channel in the Sky (Excuse the pun
;))
Right,
In the first of a series of tutorials I'm going
to cover one of the methods of getting information
into a flash movie. You might ask why but in this
case it's to enable the creation of a simple reusable
button in Flash. The benefit being that once the
button is created, with whatever style of mouseover
animation necessary, it can be duplicated within
a page and edited simply via the HTML source code.
The
button below has a simple colour change on mouseover.
The text is set to "Menu 1" and the
URL points to the homepage of technology vault.
Ok,
lets start with a little HTML source code shall
we? below is the code as produced by the "publish"
command in flash.
<HTML>
<HEAD>
<TITLE>dynamic_button</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
WIDTH=93 HEIGHT=47>
<PARAM NAME=movie VALUE="dynamic_button.swf">
<PARAM NAME=quality VALUE=high> <PARAM
NAME=bgcolor VALUE=#FFFFFF> <EMBED src="dynamic_button.swf"
quality=high bgcolor=#FFFFFF WIDTH=93 HEIGHT=47
TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</BODY>
</HTML>
So,
how do we pass our button it's title and URL it
should point to? Simple really, all you do is
add URL encoded variables to the end of each movie
name/value pair. Like this:
Note
that this must also be added to the <embed>
statement. If you don't understand the logic of
URL encoding simply start with a ? and remember
to add a + sign instead of a space. If you want
to add another variable precede it with an &.
Don't
worry about the "buttontext" and "buttonURL"
variables at the moment we'll get to those when
we open the Flash source code. Put simply the
easiest way of passing variables into flash is
to do it on what is effectively the querystring.
The
Flash code.
Click
here to get hold
of the .fla file used in this tutorial.
Open
the above .fla and right click on the button on
the stage. Select the "actions" tab
and you should see:
Notice
our friend buttonURL? Now the first rule to consider
when importing variables in this way is that they
are ALWAYS available from the _root of the movie.
Therefore when using them inside the flash code
you must always reference them via the root. You
could change the event action to be on rollOver
if you wish and also the target of the getURL
action doesn't have to point to the current page.
It could point to a page within a frameset for
example.
Now,
close the actions panel and double click on the
button on the stage. This will open the button
itself for editing. Click on the "Text"
layer on the layer inspector and the "Text
Options" panel should change to:
Notice
that the variable associated with our dynamic
text object is in fact buttontext (note that this
automatically assumes it is pointing to the root
so you don't have to add _root.).
Summing
up:
So,
simply duplicate this movie as many times as you
need and in your HTML file changing the variables
passed to the .swf file to those required. All
this for a total of 347 bytes of download time!
The
next tutorial will look at storing these variables
in an external text file allowing you to edit
one simple string of text to modify the flash
movie. We will then move onto duplicating the
button at runtime within the flash file and maybe
even sub menus!
If
you do start this tutorial PLEASE drop me an instant
message in the forums or email
me so that I can get an idea of their popularity.
If you have any questions please post them in
the forums
and I'll try to get around to them as quickly
as I can! Please quote ref: dia001
Dia.
Would
you like to write a Tutorial for us? It could
be a tutorial about anything that you like! How
about "How to build your first web page?"
Or basic html, Flash, Powerpoint presentations,
just about anything that needs a bit of tuition
to get somebody started!
UK Mobile operators get new watchdog Mobile phones, the fashion accessory of the younger generation, now get their own independant classification body... Read More
Thursday 7 October, 2004
BPI to sue UK filesharers Major uploaders to be targeted Read More
Tuesday 5 October, 2004
BT Blocks Internet diallers 1000 premium rate Internet dialler numbers blocked Read More
Tuesday 28 September, 2004
More Delays for Half-life Sequel? Just when we thought it was getting close... Read More