Solved

Timed banner ads in a flash preloader

Posted on 2007-11-13
5
175 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error 2032 in all the browser 6 2,837
Adobe Flash Player won't run in IE or Firefox but will in Chrome 20 330
Firefox fullscreen video lags 4 163
EMET 5.2 / Adobe Flash 2 236
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 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…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

777 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