Solved

Timed banner ads in a flash preloader

Posted on 2007-11-13
5
177 Views
Last Modified: 2010-04-14
I have a working preloader that I would like to place timed banner ads in. What I would like to happen is for a banner ad to display for 5-10 seconds at a time and be able to be clicked by the user. Essentially I want users to see multiple random ads while waiting for the site to finish loading. Does anyone know how to do this in actionscript?
0
Comment
Question by:krmarks
  • 3
5 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 20278152
there's many options you can go with.
you can create a movieclip with each banner in a different frame  - or load them as required or attach them from the library.
and then use a setinterval to cycle through the frames,
each banner ad will just be a movieclip with an .onRelease event which you can use to add a function to do whatever when they click on it.

if you go with the movieclip option,
you can simply do this

function doLoadFile(which:Number) {
switch(which) {
case 1:
getURL("http://www.google.co.za", "_blank");
break;
case 2:
getURL("http://wikipedia.org", "_blank");
break;
}
}

etc.
myBannerClip.onRelease = function() {
doLoadFile(this._currentframe);
}

i havent' tested it but it should work.

blu.
0
 

Author Comment

by:krmarks
ID: 20285891
I am having trouble getting this to work, my actionscript my just not be up to the task. Here is what I have in my preloader:
I have 1 frame that contains 3 layers.
Layer 1: Actions - contains all the actionscript
Layer 2: text - holds the loading text
Layer 3: circle - holds a circle animation

The actionscript I have is as follows:

function setProgress(pt) {
      circle_mc._rotation += 12;
      loading_txt.text = "Loading: "+Math.round(pt)+" %..";
}

That is all I have in there, I call the preloader as a parameter, which passes the pt value.
0
 

Author Comment

by:krmarks
ID: 20316463
Bumping this for difficulty.
0
 

Accepted Solution

by:
krmarks earned 0 total points
ID: 20482561
Well, I got this working with some dog and pony code. I would really like to be able to set an actual timer on the ads, but it works....

function setVisible() {
EMC._visible = false;
Ad_2._visible = false;
Ad_3._visible = false;
Ad_4._visible = false;
}

function setProgress(pt) {
      circle_mc._rotation += 12;
      percent_loaded = Math.round(pt);
      loading_txt.text = "Loading: "+percent_loaded+" %..";
      if (percent_loaded == 0){
            setVisible();
      }
      //Trace(percent_loaded);
      if (percent_loaded == 1){
            EMC._visible = true;
      }
      if (percent_loaded == 33){
            EMC._visible = false;
            Ad_2._visible = true;
      }
      if (percent_loaded == 66){
            Ad_2._visible = false;
            Ad_3._visible = true;
      }
}
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question