Solved

Timed banner ads in a flash preloader

Posted on 2007-11-13
5
172 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
Comment Utility
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
Comment Utility
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
Comment Utility
Bumping this for difficulty.
0
 

Accepted Solution

by:
krmarks earned 0 total points
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
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 what frame rate is, how to control it and what effect it has on the video.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now