Solved

Timed banner ads in a flash preloader

Posted on 2007-11-13
5
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…

617 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