Top 10 Flash Questions and Answers for Newbies & Wannabies

by Collado on January 2, 2008

top secretThis is an opportunity to share some tips with beginning to intermediate Flashers who want a quick, friendly way to get that Flash on. The code samples in here are actual working chunks of code. I assume you already know something about ActionScript and Flash (or Cut and Paste, if you know what I mean). If you don’t know what trace() is, point that cursor away before you hurt somebody. I’m not kidding. Right now!

10- Q: How can I make my Flash site display current time and date?

A: You can do it with the help of the Date() class available in Action Script. This class has all the necessary methods to retrieve full information about the current time. Before using these methods you need to create a date “object” in the class, this is because the methods are not static and they can only be applied to a single object. To create a Date object please, use the following syntax:

var current_time = new Date();

After that you can use different methods for this object getDate(), getDay(), getFullYear(), getHours(), getMilliseconds(), getMonth() and so on). Use Flash Help documentation to learn more about the Date() class and its methods.
For example:

current_time.getMonth();
current_time.getFullYear();

Note: You can retrieve both your operating system time and universal time - UTC (known before as GMT Greenwich mean time). To display UTC time you should use the methods that have “UTC” in their names (getUTCDate(), getUTCDay(), getUTCFullYear(), getUTCHours(), getUTCMilliseconds(), getUTCMonth() and so on)

See also:

How to set up the current time and date demo movie

Here’s the code used in the demo movie:

var today = new Date();
var minutes = today.getMinutes();
var hours = today.getHours();
var dat = today.getDate();
var month = today.getMonth()+1;
var year = today.getFullYear();
var dayN = today.getDay();
switch (dayN) {
case 0 :
day = "Sunday";
break;
case 1 :
day = "Monday";
break;
case 2 :
day = "Tuesday";
break;
case 3 :
day = "Wednesday";
break;
case 4 :
day = "Thursday";
break;
case 5 :
day = "Friday";
break;
case 6 :
day = "Saturday";
break;
}
if (hours>12) {
c_time = (hours-12);
AM_PM = "PM";
}
if (hours==12){
c_time = 12;
AM_PM = "PM";
}
if (hours<12){
c_time = hours;
AM_PM = "AM";
}
if (hours==0){
c_time = 12;
AM_PM = "AM";
}
if (minutes<10) {
is_zero_min = "0";
} else {
is_zero_min = "";
}
if (dat<10) {
is_zero_dat = "0";
} else {
is_zero_dat = "";
}
if (month<10) {
is_zero_mon = "0";
} else {
is_zero_mon = "";
}
output = c_time+":"+is_zero_min+minutes+" "+AM_PM+" "+day+" "+is_zero_dat+dat+"."+is_zero_mon+month+"."+year;

9- Q: How do I edit images on Flash?

A: Open your source “FLA” file in Adobe Flash and press “F11″ to launch symbols library. To perform search of a needed image symbol will be easier if you sort them “by kind” simply by pressing “kind” tab at the top of symbols list. You’ll see that all bitmap symbols are grouped now at the top of the whole symbols library.

Adobe FLash Publishing Settings Window

Bitmap Symbols in Library

Browse these symbols to find symbol your want to substitute. You can see symbols preview at the top of symbols library. When you have found necessary bitmap symbol double click the icon on the left of it as to see the symbol properties window.

Adobe FLash Publishing Settings Window

Bitmap Properties

You’ll see image preview and options there. Check the image size. It looks like 284 x 423 pixels at 32 bits per pixel. To make your image fit the original effects and animation the best way your image must be exactly the same size as in the original image.

You can resize or crop your image using Adobe Photoshop. Open your image in it using “File/Open…” from the top menu. To resize or crop choose “Image/Image Size…” or “Image/Canvas Size…” accordingly. Then save image using “File/Save As…”, for using it in flash choose one of the following image formats: “JPEG”, “GIF” or “PNG”.

Press “Import” button on the left and browse to location of your image file.

At the bitmap symbols properties window you can change the image quality. Make it lower to reduce published file size.

Now you should publish your flash movie.

8- Q: Can you give me a step by step explanation on how to publish my Flash site?

A: You may want to modify the publish settings to reduce the download time or increase the image quality. To do so, please, choose “File/Publish Settings…” from top menu. In “Publish Settings” window choose “Flash” tab. The main options that have significantly influenced the published “SWF” movie file size are Jpeg Quality, Audio Stream and Audio Event.

Adobe FLash Publishing Settings Window

Publish Settings

To change jpeg image compression ratio move “Jpeg Quality” slider or type it in the input box at the right of it. Low quality (high compression) extremely reduces download time by flash looses its professional look. Try to experiment with quality to get optimal size/quality balance.

Another way to affect movie size is to change Audio Stream and Event options. Press “Set” button on the right to change music quality options.

Quick Tip! Actually, you can publish your movie directly from “Publish Settings” window, see “Publish” button at the bottom. Or you can publish it from every point of Adobe Flash by pressing “SHIFT+F12″ hotkey.

Published “SWF” file will appear in the folder were corresponding “FLA” file is located.

Replace old “SWF” file in “yourwebsite.com/flash” folder with a new one. Now it’s time to check modifications you’ve made. Go to the page on your website were you have embedded the movie and launch it to see the changes.

7- Q: How can I add a flash page to Favorites?

A: You should use the following Java script to bookmark the page:

on (release) {
    getURL ("javascript:window.external.addFavorite(’http://www.website.com’,
‘Website<br />Title’)"
);
}

You can apply this script to any button (text, image). It should work.

6- Q: How can I can make a certain number of images display randomly?

A: In Flash (as well as in JavaScript) you can use the Math.random() function which generates pseudo-random numbers. This function can help you in making a slideshow when you need to use a large amount of images. You only have to store these images in the Flash library, convert them to slideshows, and give them names (that include the various numbers assigned to each slide). After that apply a code similar to the one shown in the following demonstration: How to make images display randomly demo movie

5- Q: How do I link a button to an Adobe PDF document?

A: In Flash MX as well as flash MX 2004 and Flash 8, a hyperlink is created through the getURL() command. The getURL() command provides a means for the browser to jump from one page to the other. The getURL() command can also be used to open an executable application like a PDF document. Click “Window” and choose “Actions” or press “F9″ on your keyboard to access the Actions panel. You should type the following action script provided below into the white space to open up an executable PDF file:

on (release)
{
        getURL("http://www.yoursitename.com/mydoc/doc1.pdf");
}

Now test your movie by pressing “CTRL+ENTER“.

4- Q: I would like to open new windows with just the images in them and certain options like no scrollbars, no toolbars, specific height and width, etc. Please, advise.

A: You can use Java script to do this.

In flash it should be assigned to the button (image, text etc.)

on (release)
{
getURL("javascript:openNewWindow(’mypage.html’,'mypage’,
‘height=xx,width=xx,toolbar=no,scrollbars=no,resizable=yes’)"
);
}

In index.html that relates to this flash you should write in the following java script, like this (don’t change anything):

<script language="JavaScript">
   function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }
</script>

Put it between tags in index.html. Then add the following part to < embed> tag:

swLiveConnect=true NAME=yourmovie.swf

(<embed src="yourmovie.swf" quality="high" pluginspage="http://www.Adobe.com/go/getflashplayer" type="application/x-shockwave-flash"
width="xxx" height="xxx" swliveconnect=true name=yourmovie.swf>
</embed>)

It will work.

3- Q: How do I duplicate symbols?

A: Duplicating a symbol lets you use an existing symbol as a starting point for creating a symbol. Open your source “FLA” file in Adobe Flash and press “F11″ to launch symbols library. From library, what we need to do is right-click (Windows) or Control-click (Macintosh) the symbol, select Duplicate Symbol and give the duplicate symbol it’s name.

Adobe FLash Publishing Settings Window

Next, drag the symbol unto the stage and give it an instance name. Note an instance name and a symbol name are tow totally different things. Meaning, that while there may be two or more instances of the same symbol with the same name “symbol 1”, each instance must have assigned a unique identifier (e.g. instance name) for all ActionScrip reference purposes.

To edit the symbol, you simply double click the symbol to access it in the Main Area. Then double click the text area and enter your own slogan. Once you edit a symbol, Flash updates all the instances of that symbol in your document. You can customize all other Flash elements by repeating these simple steps.

2- Q: Does Google index sites that use Adobe Flash and How do I use SEO for my flash website?

A: Yes, Google indexes pages that use Adobe Flash. However, their crawlers may experience problems indexing Flash pages. If you’re concerned that Flash content on your pages may be inhibiting Google’s ability to crawl your site, you may want to consider using a text browser such as Lynx to examine your site. If features such as Flash keep you from seeing all of your site in a text browser, then search engine spiders may have trouble crawling your site.

You may want to consider creating HTML copies of these Flash pages for the crawler. If you create HTML copies, please be sure to include a robots.txt file that disallows the Flash pages in order to ensure that their crawler doesn’t recognize these pages as duplicate content. A hybrid site such as this, works especially well, if your navigation uses traditional HTML links. You can use cascading style sheets to give the appearance of flash text links. This type of hybrid site will always rank better than an all Flash site - all other factors being equal. It’s also important to have your HTML page title correct, regardless of anything else. Several search engines look at meta titles first. In addition to the page title, you can add meta tags to the head of the file.

Outside of the actual HTML page, off page factors are important. One-way links (sometimes called inbound link) pointing to your site from highly relevant and high ranking pages will increase your page rank. In addition links from prominent directories, such as Yahoo and Business.com, placed in the most relevant categories will help. One-way inbound links from relevant sites is still the best way to increase your ranking with or without Flash.

Quick Tip! You might also want to consider creating and submitting a detailed site map of your pages using Sitemaps. Sitemaps are an easy way for you to submit all your URLs to the Google index and get detailed reports about the visibility of your pages on Google. With Sitemaps, you can automatically keep them informed of all of your current pages and of any updates you make to those pages.

To learn more about Google and how to optimize Flash for higher ranking, got to http://www.google.com/webmasters/

1 - Q: Does anyone know a free, easy way to create Flash for my website or to create a flash website?

A: Flash animation is a very attractive element of your website. You can easily created using Flash templates.

A Flash template is a complete site design that can be opened with Adobe Flash, filled with content and edited to suit particular needs. Flash templates will give your website a professional look with a minimal time and money expense.

Quick Tip! Most quality template shops will provide you with a free flash template so you can evaluate the quality of the product and try your skills before you buy.

***New Years Bonus Question***

How to create a Flash form to send email without any knowledge of ASP, PHP or any other programing languages?

A: If you have been searching around trying to figure out what is the easiest way to make a Flash contact form work, check out this post.

If you guys find these answers useful please make sure to give it a digg by clicking the digg button…. we really appreciate it! Also let us know what other questions you might have or any tutorials you think might be useful. Basically, help us help you.

{ 8 comments… read them below or add one }

1 Adriana 02.13.08 at 9:04 pm

Hi,Collado
you do a great job here..Hope I will learn Fdlah with you cos you have
great tutorials.Im ashamed to say that I finisned MUltimedia design in Cooenhagen
and we had just a 2 week course in Flash!!!!!!!2 weeks??come on!!!!
Now, I really want to learn Flash cos is was a nightmaire to me!!
but, its getting better now!!Juts want to ask you how can I insert a”search”function
in Flash using the PHP as well?
all the best, Adriana :)

2 Chris Hickman 03.22.08 at 11:15 pm

Thank you for questions 3 + 5. I was extremely frusterated in trying to figure out how to simply duplicate content without creating what I’ve viewed as a linked copy. I also didn’t know the keyboard shortcut for opening actions pertaining to the symbol that I was using.

I’m a professional PHP/MySQL developer. I have over 10 years of experience and am also an expert at Adobe Photoshop, Javascript, AJAX, etc. Flash has always felt like the most absolutely counter-intuitive development tool. For this reason, I’ve always used SWiSHMax — which I’ve developed some extraordinary projects in
(www.metroplex360.com/DynamicSPACE/)

It was answers to simple areas of confusion like you gave here in this blog post that had me stuck and frustrated.

Thank you!

3 Collado 03.23.08 at 3:27 pm

Thanks Chris I’m glad you like it… On another note I would like to share with you an open invitation to take part of this blog by sharing your expertise with the rest of us foamers.

All you need to do is Register; contributing authors will benefit through the use of back-links (also called inbound links or links from another site to your site) inbound links are great because they provide Google with additional information about your site, which in turn increases your sites PR… hence the higher you are in the search engine rankings, the more traffic and clicks you will get.

4 Ramesh 07.29.08 at 11:31 am

how can i reduce with flash banner size and i want keep image qualty,

5 Collado 07.30.08 at 6:00 am

Can you provide a link to the site, or send me ( sales@foamers.net ) the FLA file FTP info etc…. be more SPECIFIC

6 Thomas 08.29.08 at 5:21 am

Thank you for all those helpfull hints. I have a quesitons. How can I fit my flash banner to the different size screen resolutions and screen width and where would I put the programming steps in the code for the page?

Thank you in advance for your help.

7 Thomas 08.29.08 at 5:25 am

Thank you for all those helpfull hints. I have a quesitons. How can I fit my flash banner to the different size screen resolutions and screen width and where would I put the programming steps in the code for the page?

Thank you in advance for your help

8 Collado 08.29.08 at 3:48 pm

Thats a good question Thomas, in fact thats a perfect example of what Flash was originally created for. What you have to do is make full use of vector graphics that can scale perfectly to any user’s monitor size/screen resolution, likewise you’ll also need go into your “Publish Settings” under “HTML” and choose percent from the “Dimensions” drop down many, then press “Publish”

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word