Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Action Script to load external image and refresh

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

dXh

New Member
Impact
0
Hello all. I am trying to create a swf that will load a specified image, then reload the same name image after 5 seconds. I traditionally would do this is Java, but that is not an option for me.
So the image changes every 5 seconds, but the name does not.
I have tried the following with no luck:
Code:
Code:
function loadImage(){
myMovieClip.loadMovie("path/to/image/image.jpg?ID="+getTimer());
onEnterFrame = function(){
if(Math.ceil(myMovieClip.getBytesLoaded()) == myMovieClip.getBytesTotal()){
delete onEnterFrame
loadImage();
}
}
}
I greatly appreciate any help I can get from the flash experts.
Thanks
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I'll assume you're using actionscript 3.0. If not, I apologize. (I never bothered to learn as2 past on(click){gotoandplay(1);}. lol)

First off, open up the components window and put a UILoader component on your frame and give it an instance name (I'll just call mine 'pictureframe').

Then, the proper code would be
Code:
import flash.utils.*;

pictureframe.source = "whatever.jpg";

var t:Timer = new Timer(5000); // 5000ms

function reloadPicture(e:TimerEvent):void
{
	pictureframe.source = "whatever.jpg?x="+t.currentCount;
}
t.addEventListener(TimerEvent.TIMER, reloadPicture);
 
0
Close
Thanks Jim!.
I will give this a shot and let you know how it works.
Again thanks for your time

david
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back