Reputation: 93
I'm making a toggle button to resume/pause the audio in Adobe flash CS 5: I used a Code Snippet "click to play/stop Sound".
Here is the code:
pause_play_button.addEventListener(MouseEvent.CLICK,fl_ClickToPlayStopSound_2);
var fl_ToPlay_2:Boolean = true;
var resumeTime:Number = 0.00;
var s:Sound = new Tanishma_Sound();
var fl_SC_2:SoundChannel ;
function fl_ClickToPlayStopSound_2(evt:MouseEvent):void
{
if(fl_ToPlay_2)
{
f1_SC_2 = s.play (resumeTime);
}
else
{
resumeTime = f1_SC_2.position;
f1_SC_2.stop ();
}
fl_ToPlay_2 = !fl_ToPlay_2;
}
I have this error and I don't know how to fix it:
Scene 1, Layer 'Actions', Frame 1, Line 47 1120: Access of undefined property f1_SC_2.
Any Help!
Upvotes: 0
Views: 85
Reputation: 14406
That error means that Flash can't find something you've referenced. In your case, this is because of a syntax typo.
You have defined: (note the f then the letter l)
var fl_SC_2:SoundChannel;
Yet later on, you've change the 'l' to the numeral '1' in three places.
f1_SC_2
Should be:
if(fl_ToPlay_2)
{
fl_SC_2 = s.play (resumeTime);
}
else
{
resumeTime = fl_SC_2.position;
fl_SC_2.stop ();
}
Upvotes: 2