Cache on Timeline?


recently created function on swf hides buttons until audio playing on frame over. when happen function called , buttons became visible again.

 

the code simple. it's this:

var my_sound:sound = new sound();

my_sound.loadsound("audio/som1_1.mp3",true);

 

my_sound.onload = function(sucess:boolean){

    if( ( _root.temporizador == 1 || _root.temporizador == undefined ) && sucess ) {

        botao_avancar._alpha = 0;

        botao_avancar.enabled = false;

        my_sound.onsoundcomplete = dosoundcomplete;

    }

}

 

function dosoundcomplete() {

    botao_avancar._alpha = 100;

    botao_avancar.enabled = true;

}

 

my problem is, whenever change frame, , button in different place on screen, appears on same position last frame, kind of cache, guess. know way fix this? it's weird.

 

i have .fla sample of in link: http://ouromoderno.com.br/flasherror/demo.fla
and have online sample, can see happens: -> http://ouromoderno.com.br/flasherror/

 

appreciate ideias.

 

(sorry bad horrible awful english )

when button appears in new place have keyframe containing button , therefore button instance.  making previous button instance not visibiel won't affect visible property of new button instance.

 

to remedy, use boolean variable record whether button visible or not.  use boolean in other frames assign new instances visible property:

 

my_sound.onload = function(sucess:boolean){

    if( ( _root.temporizador == 1 || _root.temporizador == undefined ) && sucess ) {

        botao_avancar._visible=false;

botao_visible=false;

        my_sound.onsoundcomplete = dosoundcomplete;

    }

}

 

function dosoundcomplete() {

    botao_avancar._visible=true;

botao_visible=true;

}

 

// on other frames:

 

whateverbotao._visible=botao_visible;

 

//p.s. use _visible property , don't have enable/disable button.



More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

Thread: Can not create raid array: mdadm: no raid-devices specified.

Thread: HOW TO: Package and theme GTK+ / Gtkmm apps in Linux for Windows

Thread: Twinview issues