ActionScript 3.0 :: Get A Simple Random SWF Loader To Work?

Feb 12, 2010

I'm trying to get a simple random SWF loader to work. and I'm close...I have 10 movies saved as movie1.swf to movie10.swf saved in a directory.For my index file (swf file that will load one of the 10 movies randomly) I have one single frame with this in the actions:

stop();
var movieArray : Array = ['movie1','movie2','movie3','movie4','movie5','movi e6','movie7','movie8','movie9','movie10'];
var loader : Loader = new Loader();
loader.load(new URLRequest(movieArray[Math.round( Math.random() * movieArray.length-1 )] + '.swf'));
addChild(loader);

For the most part it works. But every now and then the screen comes up empty on a refresh. My guess is the math might be slightly off and is calling a file that is not there.

View 9 Replies


Similar Posts:


ActionScript 3.0 :: Can't Get A Simple Flash.display.Loader To Work

Sep 12, 2011

The MovieClip art Gallery is added to the stage just fine, but it's .as class can't even display a simple image 'elephant.jpg'.

ActionScript Code:
package
{
import flash.display.MovieClip;

[Code].....

View 3 Replies

ActionScript 3.0 :: Game App Runs Fast In Simple Loader And Slow In Other Loader?

Apr 28, 2010

I'm feeling a bit low now as I have been suffering this for months. A simple loader loads my simple game and runs VERY FAST on even slow pcs BUT when I build this other loader, it goes quite slowly and I don't know where the app is going wrong. WHERE is the processing consumptoin coming from out of my app.

[Code]...

View 1 Replies

ActionScript 2.0 :: Simple Loader Fails When Loading In An .swf Containing The Loader?

Jun 26, 2007

Sorry for the complicated topic. I got a .swf that loads in other .swfs. Rather than figuring out how to make a loader for loading .swfs I thought I'd just use a simple loader in the .swf I'm loading.

However, it doesn't work. It starts fully loaded but doesn't finish. Heres the AS:[AS]_root.stop();
PercentLoaded = _root.getBytesLoaded()/_root.getBytesTotal()*100;

[code].....

View 1 Replies

ActionScript 3.0 :: Loader+Math.random - RandomNumber Not Loading Random Images?

Feb 26, 2012

why is this code NOT loading a random image, despite tracing random number?
 
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import flash.display.MovieClip;

[Code]...

View 3 Replies

ActionScript 2.0 :: Simple Loader Bar To Display On Site?

Nov 26, 2009

I am just looking for a tutorial for a simple loader bar. My flash site is quite large and as a result, a simple loading screen leads people with slower connections to believe that maybe it has crashed during load and don't wait till it's finished. A load bar would obviously show that the site is still downloading.

View 1 Replies

ActionScript 3.0 :: Loader SWF Height And Width/Overflow Question- Simple Banner Ad?

Aug 13, 2010

I'm trying to create a simple banner ad where the mouse hovers over the button and a panel shows up over some content of the site.Take a look at the one here in the center of the page: [url]....I have two different .swfs: the container, which is the button and a loaded swf that has the animation that comes up when the button is clicked. The button is only 183 x 40px where as the loaded swf is 183 x 160px.

When the loader swf is loaded, it takes the dimensions of the button.Is there a way to have the loader swf be its original dimensions, so when the mouse hovers over the button, the loader swf covers some of the content on the Web site? Is loading SWfs even the proper way to do this? Also, how can I change the MouseEvent to load the SWF when the mouse is only over the button and not clicking? The simple code I have so far:

stop();
var myLoader:Loader = new Loader();
open_btn.addEventListener(MouseEvent.CLICK, loadBanner);[code].....

View 1 Replies

Making Simple, Random Slide, Slideshow?

Jul 14, 2009

I was wondering how would i go about making a simple application that can be run on a website that can:
-show a opening page that will stay for 5 seconds (for advertisments)

-show random pictures (well they will only be text)

-can change slide by clicking on screen.

View 1 Replies

ActionScript 3.0 :: Create A Simple Random Number Generator?

Oct 11, 2010

I'm totally new to ActionScript 3 and just trying some very simple things to try to understand how it works in Flash CS5. I have no-one mentoring me so these forums are my first port of call.  I wanted to create a simple random number generator. Very simple. Click on a button (first_50) that displays a random number in a text box (main_balls.text) set to Classic/Dynamic. The script I have is as follows:
 
first_50.addEventListener(MouseEvent.CLICK, firstFiftyGenerator);
function firstFiftyGenerator(limit:Number):Number
{
var randomNumber:Number = Math.floor(Math.random()*(limit+1));
return randomNumber;
main_balls.text = String(firstFiftyGenerator(50));
 
I get no errors in the compiler and my button works in runtime. I just don't get a number in my text box when I click on it.

View 5 Replies

Preloader With Random Image Loader?

Jul 9, 2009

I would like for the website preloader to recognize the random image loader that I have on frame 8 of my siteI have a basic preloader on frames 1 and 2(frame 1)

amountLoaded:Number=_root.getBytesLoaded()/root.getBytesTotal;
(frame 2)
if(_root.getBytesLoaded()==_root.getBytesTotal()}

[code]......

View 9 Replies

ActionScript 2.0 :: Random Array Loader?

Aug 7, 2008

I have an Array Randomly loading images on to the stage, there is a 'splice'so no 2 images repeat. the problem is - once the images all get 'deleted' there are no more images the array can pull. I want the images to be recreated in the array.That way It will load the 29 images I have Randomly, with out repeating them and after all 29 appear it will start over again.If I remove the 'splice' I can load as many images as I want however some load twice or more before the batch is complete.

Code:
var images:Array = new Array();
for (var i:Number = 0; i < 29; i++) {
images.push("image" + i + ".jpg");[code].....

View 1 Replies

ActionScript 3.0 :: Loader Loads Random Image?

Aug 1, 2010

Is it possible to get a loader to load and display a random image?My background images are quite large so I would prefer to use a loader to keep the file size down but I'm struggling to work out how to randomise the images.

View 2 Replies

ActionScript 3.0 :: Can't Get Simple Go To Scene To Work In 3.0

Jul 7, 2009

I am just testing out how to place a button to go to a scene.I have 2 scenes named, one and two and 2 buttons...One on each scene to get them back to the other scene.The instance names on the buttons are scen1_btn and scene2_btn.My Functions are just called scene1 and scene 2.The code I have below is what I wrote, and I thought would work, but isn't.[code]

View 5 Replies

ActionScript 3.0 :: Simple Slideshow Does Not Work ?

Oct 24, 2010

I have this little slideshow, it is for practise for my students. It always worked well in as 2.0, 5 slides, and two buttons: back and next.The script in2.0 has: prevFrame and nextFrame in the code and for the exceptions in frame 1, and frame 5 we made a new frame 1 in the actions layer, and coded the back button, gotoAndStop(5); and a new frame 5, and coded the next button: gotoAndStop(1); Works.

Now I put the thing over tot as 3.0: And I can not get it to work properly....the buttons work, but when I am on frame 5, and go back to 4, it will go no further than 4, evenso when I go back to frame 1 from 5, I can not go further up than frame 1.

import flash.events.MouseEvent;
stop();
next_btn.addEventListener(MouseEvent.CLICK, volgendFrame);//next_btn.addEventListener(MouseEvent.CLICK,[code].....

View 5 Replies

ActionScript 3.0 :: Can't Get A Simple GotoAndPlay To Work

Jan 13, 2012

I'm not familiar with AS3 at all.I'm working on a simple 2 minute presentation. For testing purposes, I have a layer named "label" that I am using to set a label called "test" (currently it's on frame 1445)I'm trying to put an action in the timeline, frame 1, that will cause the play head to automatically jump to the "test" label so as I build the presentation and test it, I don't have to sit through the entire thing just to see if my latest animations are working as expected. I'd like to move this "test" label down the timeline as I continue to build new parts of the presentation. I would expect this code to jump the play-head to where ever I put that "test" label..Instead, it either doesn't work at all, or it jumps to some other random spot around frame 160. NO other labels are being used in this presentation (I'm using the FlashEff component plugin for effects, in case that info is necessary)

View 2 Replies

ActionScript 3.0 :: Simple Rollover Won't Work?

Jan 14, 2010

I'm an AS2 guy finally being drug into the AS3 world and finding it difficult.I just want to make a simple rollover effect.[code]I noticed the first line in the code, do I have to import something? Either way my text in the button doesn't move when I rollover. It moves upon render but then it stops.URl...

View 2 Replies

ActionScript 2.0 :: Simple If Statement Won't Work?

Feb 18, 2006

I am using Flash 8, and for some reason, my if statement won't work. I have a scrollbar which scrolls a movieclip (that contains AS loaded material (eg. attachmovie). I want it so that only when the material is longer than the scrollbar do I see the scroll bar.For some reason, it doesn't work. The traces don't even work!

if (scrollbar._height < menu_mc._height) {
scrollbar._alpha = 100;
trace("works");[code].....

View 2 Replies

ActionScript 2.0 :: Simple GotoAndPlay Does Not Work?

Jan 25, 2005

I have a scene for the title screen and a scene for the game itself. On the title screen i have a start button, that when clicked it is supposed to go to the game scene; but for some reason this wont work.

actions for startclick (start)
on(release){
gotoAndPlay("Game", 1);
}

View 8 Replies

Professional :: Random Swf Loader Repeating Previous Swf Load?

Mar 8, 2011

I Have about 10 images that will be loading into my home page using the code below. the problem that I am getting is that occasionaly the same image will load twice in a row. is these some code I can insert into my existing code so that the images will not load twice in a row?

var movieArray:Array = ['Simage/Simage0','Simage/Simage1','Simage/Simage2'];
var loader:Loader = new Loader(); var index:int = movieArray.length * Math.random();
var url:String = movieArray[index] + '.swf';  trace("Attempting to load", url); 

[code].....

View 5 Replies

ActionScript 2.0 :: How To Get Simple HitTest To Work With Two MCs (Lines)

Nov 30, 2009

I am having trouble getting a hitTest to work. My two MCs are lines, one horizontal, one slanted. When the horizontal line gets within the "bounding box" of the slanted line the hitTest is true, but it's not touching the slanted line yet. I saw that the shapeFlag property comes into play here, but only when using coordinates... I'm not sure how to apply it to these two lines. I want the hitTest to be true only when the lines actually touch. I have attached a simple FLA of the problem.

View 1 Replies

ActionScript 3.0 :: Why Doesn't This Really Simple Code Work?

Mar 16, 2009

What I'm Trying To Do: Modify the y coordinate of a MovieClip on the stage from an external .as File, simple as that.If someone could tell me why its not working and how I can go about fixing it without modifying the existing class structure
(ChildOfMain must subclass MainClass).

Download
Source Files 6 kB

For those of you who don't want to download the source files (I thought it would make it easier if you could handle it yourself)

Document Class For Project: Main Class
Objects In Project Library
platform (movieclip)
subjectMovieClip (movieclip)

[code]....

View 6 Replies

ActionScript 2.0 :: Make Simple GotoAndStop Work

Mar 23, 2005

I boggled with this simple script.This script is on the MC. Everything works except the last onRelase function which just won't go to "disable". If I change "disable" to "fadein" it will work. Please see the attached timeline pic to get better idea and please do let me know what I'm doing wrong.[code]

View 14 Replies

Professional :: Cannot Get A Simple Flash Button To Work?

Jul 20, 2011

I do not know action script, and, have created a button in flash that pops up information when you rollover the button.The button works fine, but, the entire area - where the information pops - is also poping up when I rollover that area.

View 4 Replies

IDE :: Getting A Simple Event Listener Class To Work?

Feb 1, 2009

I am having trouble getting a simple event listener class to work. The class is:

Code:
package {
import flash.display.Sprite;
import flash.events.*;

[code]...

and I have the ClassPath pointing to the folder that contains this .as file. I do get the trace "In setUp" but I'm not getting seeing any Keyboard events. There also aren't any errors showing up in output so I am kind of stumped.

View 1 Replies

ActionScript 2.0 :: Get A Simple Fade Out Of A Logo To Work?

Oct 11, 2004

I've been trying to get a simple fade out of a logo to work. I converted the logo to a movieclip called logo_mc I click on the logo_mc movieclip and insert this actionscript.

onClipEvent (load) {
if (this._alpha>0) {
this._alpha -= 5;
}
}

I have also tried putting the code on the main timeline without any success.

If I understand correctly this should see if the alpha is greater than 0 and if it is it should decrease the value by five increments until it reaches 0.

View 3 Replies

ActionScript 3.0 :: [new Loader()] Does Not Work?

Aug 19, 2010

I have a two movie clips (preload.swf and index.swf).Starting with preload.swf. Preload movie clip loading index.swf.But nothing works on index movie clip (stage resizing, mouse events).

View 1 Replies

ActionScript 3.0 :: Load And Replace Random Swfs Into Same Loader On Stage?

Jun 28, 2009

for some reason escapes me: using AS3 how can a swf load another swf to replace itself in the same loader on the stage, while simultaneously calling a randomizing function in the first frame of the main timeline, to randomize the next swf?At the end of each swf (called "koan_#.swf") there is the following old AS2 code...it was used to randomly select and then play a swf from koan array:

_root.index++
if(_root.index>_root.koan.length-1){
_root.index=0;

[code].....

View 5 Replies

ActionScript 2.0 :: Simple HitTest To Work For Rounded Walls

Mar 19, 2009

I've been trying to write a hittest that will work for rounded walls on my RPG. But I've been epic phailing.

Heres my code:
onClipEvent(load){speed=10;
}onClipEvent(enterFrame){if(Key.isDown(Key.UP)){this._y-=speed;this.gotoAndStop(5);
}if(Key.isDown(Key.DOWN)){this._y+=speed;
this.gotoAndStop(6);}
if(Key.isDo wn(Key.RIGHT)){this._x+=speed;this.gotoAndStop(7);
}if(Key.isDown(Key.LEFT)){this._x-=speed;this.gotoAndStop(8);}

View 2 Replies

Create A Simple Profile On Recording Artist For Work

Sep 1, 2009

I'm using Flash to create a simple profile on a recording artist for work. I'm trying to embed a minute-long .mov file into Flash, so when someone clicks the "watch" button I created, it changes frames and plays this .mov file. I have everything uploaded, but the .mov file only shows up on certain computers when someone actually clicks the "watch" button. It works on my Mac, a friend's Mac, but on the three PCs I've tested, it won't show up. The Flash file itself works, but the .mov file won't show up on the frame when it is accessed.The flash file containing the .mov is embedding onto a .php page made in Dreamweaver. On all computers, when the .swf is accessed directly, the .mov file will work properly. On the PCs, when the .php page is accessed and the Flash loads, the .mov will not load.URL...

View 1 Replies

Professional :: Can't Seem To Get A Simple Scroll Pane To Work Correctly

May 19, 2010

I'm searched and searched and tested this, but I can't seem to get a simple scroll pane to work correctly.  I have a bare-bones file, with dummy text here:[URL]..
 
Can someone download this and put the dummy text inside a scrollpane for me (using the ruler guidelines as a guide)?  I'll even send you $10 via PayPal if you can get the text to look right inside the scrollpane...
 
I can't believe I have to resort to this, but I'm about to pull my hair out,

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved