Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Timed banner ads in a flash preloader

Posted on 2007-11-13
5
Medium Priority
?
180 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
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.

688 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