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

problems with artwork animation speed when using .swf


tcmt

Recommended Posts

Posted

hello all,

 

i created a flash animation in adobe flash and exported it as an .swf. i set the framerate to 29,97fps in flash and the exported file plays at the right speed when it play i in flash player. but when i use the .swf file in hyperspin it gets sped up. my guess is that it plays at 60fps inside hyperspin and therefor the animation is way too fast.

is there any way to solve that, so that my .swf is independent of hyperspins framerate and always plays at the speed (framerate) i set it to when creating the swf?

 

thanks for reading. hope somebody can help me.

 

cheers

tim

Posted

i had a lengthy discussion with jamesbaker (thanks again mate!) today on this matter and it turned out that the animation runs at the correct speed for me when i design the animation in 60fps in flash. 30fps animations gets sped up for me in hyperspin whereas 120fps animations slow down. 

 

BUT that might be only on my PC, where hyperspin itself runs at 60fps i think. so my question is, does hyperspin always run at 60fps on every pc or is it different for every pc? (for example someone with a 120hz monitor might have hyperspin run at 120fps?)

 

someone got any more insight into that matter?

 

thank you!

tim

Posted

Not 110% sure about it but as far as I get the stage framerate is a property you can set on a .swf and will affect the parent stage (the stage used in HS itself). Netstream videos seems to not be affected by the stage framerate.

 

As far as I've seen setting 120 fps simply does not work but maybe it's due to screen refresh or/and gpu v-sync. I'm using code to display the fps

var startTime:Number;
var framesNumber:Number = 0;
var fps:TextField = new TextField();
 
function fpsCounter():void
{
    startTime = getTimer();
    addChild(fps);
 
    addEventListener(Event.ENTER_FRAME, checkFPS);
}
 
function checkFPS(e:Event):void
{
    var currentTime:Number = (getTimer() - startTime) / 1000;
 
    framesNumber++;
     
    if (currentTime > 1)
    {
        fps.text = "FPS: " + (Math.floor((framesNumber/currentTime)*10.0)/10.0);
        fps.textColor = 0xFF0000;
        fps.y = 100
        startTime = getTimer();
        framesNumber = 0;
    }
}
 
fpsCounter();

BTW doing some test with JJB we have noticed that netstream videos use GPU decoding by default, to turn off GPU decoding use
 

ns.useHardwareDecoder = false ;

To set the stage at 60 fps use

stage.frameRate = 60;
  • 2 weeks later...
Posted

 

Not 110% sure about it but as far as I get the stage framerate is a property you can set on a .swf and will affect the parent stage (the stage used in HS itself). Netstream videos seems to not be affected by the stage framerate.

 

As far as I've seen setting 120 fps simply does not work but maybe it's due to screen refresh or/and gpu v-sync. I'm using code to display the fps

var startTime:Number;
var framesNumber:Number = 0;
var fps:TextField = new TextField();
 
function fpsCounter():void
{
    startTime = getTimer();
    addChild(fps);
 
    addEventListener(Event.ENTER_FRAME, checkFPS);
}
 
function checkFPS(e:Event):void
{
    var currentTime:Number = (getTimer() - startTime) / 1000;
 
    framesNumber++;
     
    if (currentTime > 1)
    {
        fps.text = "FPS: " + (Math.floor((framesNumber/currentTime)*10.0)/10.0);
        fps.textColor = 0xFF0000;
        fps.y = 100
        startTime = getTimer();
        framesNumber = 0;
    }
}
 
fpsCounter();

BTW doing some test with JJB we have noticed that netstream videos use GPU decoding by default, to turn off GPU decoding use

 

ns.useHardwareDecoder = false ;

To set the stage at 60 fps use

stage.frameRate = 60;

This worked perfectly.

I'm having a issue: The sound sometimes keeps playing in the background when i've changed the wheel selection.

Does it need a action to stop? It doesnt happen everytime, its weird.

Posted

Are you loading a video in the .swf or what you hear is the music of the video in hyperspin? Flash has some problems with buffer, if you are loading a video or an .mp3 it would be better to use keyboard event to close the stream when a key is pressed.

Posted

Are you loading a video in the .swf or what you hear is the music of the video in hyperspin? Flash has some problems with buffer, if you are loading a video or an .mp3 it would be better to use keyboard event to close the stream when a key is pressed.

 

sadly even with with keypress listener this audio glitch happens from time to time (at least for me it does). it (mostly) seems to be an issue with (override-)transitions. when i deactivate those i have zero audio glitches when changing the wheel.

 

there are some other solutions to this problem like running your video/animation rendered as a mp4 through the video folder in hyperspin. or do a combination where you get the sound from a mp4 movie in the video folder while simultaneously embed a silent movie/animation in a .swf. all of those solutions are not the easiest or prettiest tho.

Posted

Are you loading a video in the .swf or what you hear is the music of the video in hyperspin? Flash has some problems with buffer, if you are loading a video or an .mp3 it would be better to use keyboard event to close the stream when a key is pressed.

I have a swf with and mp3 in it (compiled with flash)

Do you have the line which closes stream when keyboard event detected?

Thank you dark13, you're great.

 

sadly even with with keypress listener this audio glitch happens from time to time (at least for me it does). it (mostly) seems to be an issue with (override-)transitions. when i deactivate those i have zero audio glitches when changing the wheel.

 

there are some other solutions to this problem like running your video/animation rendered as a mp4 through the video folder in hyperspin. or do a combination where you get the sound from a mp4 movie in the video folder while simultaneously embed a silent movie/animation in a .swf. all of those solutions are not the easiest or prettiest tho.

I tried using background music... the theme repeats but the BG music doesn si i'm looking for another solution.

The transition fix is just for that swf theme or I must deactivate all of them?

I renamed my OverTransition where i'm having problems and I will update it as I keep trying. If i see this bug again i'll tell you.

Posted

here is the code. Note, that you need to edit the component name (in this example "flvControl") according to your video player instance.

stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void{
if (e.keyCode == Keyboard.ENTER){
flvControl.getVideoPlayer(0).close();
}
if (e.keyCode == Keyboard.ESCAPE){
flvControl.getVideoPlayer(0).close();
}
}

you can simply add listeners to whichever keys you need, like for example:

if (e.keyCode == Keyboard.UP){
flvControl.getVideoPlayer(0).close();
}

or 

if (e.keyCode == Keyboard.LEFT){
flvControl.getVideoPlayer(0).close();
}

also works with standard keycodes.

 

cheers

tim

Posted

here is the code. Note, that you need to edit the component name (in this example "flvControl") according to your video player instance.

stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);
function myKeyDown(e:KeyboardEvent):void{
if (e.keyCode == Keyboard.ENTER){
flvControl.getVideoPlayer(0).close();
}
if (e.keyCode == Keyboard.ESCAPE){
flvControl.getVideoPlayer(0).close();
}
}

you can simply add listeners to whichever keys you need, like for example:

if (e.keyCode == Keyboard.UP){
flvControl.getVideoPlayer(0).close();
}

or 

if (e.keyCode == Keyboard.LEFT){
flvControl.getVideoPlayer(0).close();
}

also works with standard keycodes.

 

cheers

tim

I'm learning soo much from you... very apreciated.

I'll try this and will comment. 

Posted

you are welcome and thanks but i have to credit jamesbaker and dark13 for this code. it is not my doing. in fact i don't have much of a clue of actionscript in general :).

Posted

If you want to use specific key already used in HyperSpin you can use this code to get the key for player 1 automatically, I still need to test it properly and add p2 keys but it should be usable. Please notice that the code is set for debugging, you can't debug this stuff if you don't use an hardcoded path as the portable code use "media" and "image" folders to get the path, so you need to comment some lines and uncomment other lines to use portable path).

var myFileName:String;
var HSpath:String ;
var mypath:String ;
var SystemName:String ;
var HSsettingLoader:URLLoader = new URLLoader();
var SettingsTXT:Array ;
var VariablesAssigner:Array ;
var VariablesAssigner2:Array ;
var HSStart:Number ;
var HSExit:Number ;
var HSUp:Number ;
var HSDown:Number ;
var HSSkipUp:Number ;
var HSSkipDown:Number ;
var HSSkipUpNumber:Number ;
var HSSkipDownNumber:Number ;
var HSHyperSpin:Number ;
var HSGenre:Number ;
var HSFavorites: Number
 
// Uncomment lines below to get portability
/*myFileName = this.loaderInfo.url;
mypath = myFileName.split(String.fromCharCode(92)).join("/");
SettingArray = mypath.split("/Media/");
HSpath = myFileNameArray3[0] ;
*/


HSsettingLoader.addEventListener(Event.COMPLETE, onLoadedHSsetting);

function onLoadedHSsetting(e:Event):void {
SettingsTXT = e.target.data.split("[P1 Controls]") ;
VariablesAssigner = SettingsTXT[1].split("[P2 Controls]");
VariablesAssigner2 = VariablesAssigner[0].split("\r\n").join("").split("Start=").join("&").split("Exit=").join("&").split("SkipUpNumber=").join("&").split("SkipDownNumber=").join("&").split("SkipDown=").join("&").split("SkipUp=").join("&").split("Up=").join("&").split("Down=").join("&").split("HyperSpin=").join("&").split("Genre=").join("&").split("Favorites=").join("&").split("&") ;

// Use the variable listed below

HSStart = VariablesAssigner2[1];
HSExit = VariablesAssigner2[2];
HSUp = VariablesAssigner2[3] ;
HSDown = VariablesAssigner2[4] ;
HSSkipUp = VariablesAssigner2[5] ;
HSSkipDown = VariablesAssigner2[6] ;
HSSkipUpNumber = VariablesAssigner2[7] ;
HSSkipDownNumber = VariablesAssigner2[8] ;
HSHyperSpin = VariablesAssigner2[9] ;
HSGenre = VariablesAssigner2[10] ;
HSFavorites = VariablesAssigner2[11] ;
    
trace(HSStart, HSExit, HSUp, HSDown, HSSkipUp, HSSkipDown, HSSkipUpNumber, HSSkipDownNumber, HSHyperSpin, HSGenre, HSFavorites);

}



stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown);

function myKeyDown(e:KeyboardEvent):void {
   // if (e.keyCode == Keyboard.ENTER) {
if (e.keyCode == HSUp) {    
 trace("ok")
     }
 }
 
// Uncomment first line and comment second line to get portability

 // HSsettingLoader.load(new URLRequest(HSpath + "/Settings/Settings.ini");
HSsettingLoader.load(new URLRequest("W:/Hyperspin test/Settings/Settings.ini"));
  • 2 weeks later...
Posted

Hi,

 

i experienced that if you don't use audio to synchronize, the swf's play faster than the actual fps selected.
Does this have any coincidence with hardware decoding/acceleration?

 

Archived

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

×
×
  • Create New...