Jump to content
(Open Beta) HyperSpin 2 is now available for everyone ×

Looping a .swf Background inside Universal Theme [How to]


dark13

Recommended Posts

Posted

In HS if you try to use a fullscreen animated swf background inside a theme it will tends to stop. Here's a workaround to have an endless looping .swf background inside a theme without continously reloading it. It will scroll even when you are moving the wheel.

Basically Background.swf loads C:/HyperSpin_1.5.1/dark13/Shared Components/BackgroundLoop.swf , here's the code. You can change the path of the file inside the .fla and create a new file that reads a different path. No animated .swf included, just create a 1024*768 animated background and test it. Use Background.swf inside a theme.

var bk_request:URLRequest = new URLRequest('C:/HyperSpin_1.5.1/dark13/Shared Components/BackgroundLoop.swf');
var bk_loader:Loader = new Loader();
    bk_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, bk_Loaded);    
    bk_loader.load(bk_request);
function bk_Loaded(e:Event): void {
    

    bk_loader.removeEventListener(Event.COMPLETE, bk_Loaded) ;
    bk_loader.width = 1024;
    bk_loader.height = 768;
    addChild(bk_loader);
    
}

The download contains also CPUGuard.swf and CPUGuard.fla. A fullscreeen .swf is quite demanding (I tested with a 120frames 1080p .swf) and as far as I've seen with these stuff HS uses CPU time even when it's hidden and an emulator is running. This is not good. CPU guard will set the framerate of HS to 1fps when it goes off focus and will change it back to 60fps when it regain focus. If you notice problems with CPU use when running an emulator just use CPUGuard.swf as Artwork1.swf, SpecialA1.swf or whatever else inside the theme. It will prevent HS using too much CPU time when you are playing games. The code for CPUGuard

 

    stage.addEventListener( Event.DEACTIVATE, deactivateCb, false, 0, true );
    stage.addEventListener( Event.ACTIVATE, activateCb, false, 0, true );
    
function deactivateCb(e:Event):void{    
    stage.frameRate = 1
    
}
function activateCb(e:Event):void{    
    stage.frameRate = 60
}

Just an example of the thing, this skin is running a 130mb scrolling background with a rotating earth .swf inside the theme (and some other stuff lol) .

770483701_thmetest.thumb.png.ddab3978a4b7e5303546a68ccaf7c9bf.png

Honestly I can add portable code to the thing to get HS path and make it portable but at this point SSDs are cheap enough to contain an HyperSpin/RocketLauncher install and using less code is always better, so just use HS/RL on your C  drive and put roms and video on external storage 😛

DefaultBK loop.zip

Posted

Hi dark13, Thank you for sharing your work with us.

Rocket Launcher writes statistics, but we don't use it. I have an idea I want to make the system selection screen show the last running game. All this is stored in the RocketLauncher\Data\Statistics ini files. Here's how to make swf read the name of the game and display it on the screen? You can try to modify MainTimeline.as - a running line, but I don't have enough knowledge how to make a certain line read, and even in the ini?

3535353453.png

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...