bsquared18
Technical User
Hi,
Kenneth Kawamoto was kind enough to provide code for a random flashcard setup. See
I added a button to flashcard #1 to try to go from that flashcard to another frame where the answer for the flashcard would be (I arbitrarily used frame 5 to test the action, but in actuality the frame would be beyond the 32 frames dedicated to the flashcards).
My added code is shown as the first couple of lines of code below. When the button is pressed, nothing happens. I assume it has something to do with the other code. Is there a way to make the two sets of code work together?
Any help would be greatly appreciated.
Also, once one gets to the answer screen, what would be the button command to take the user back to the random screen they just left?
Thanks! Bill
// ActionScript 2
this.ans_button_1.onPress = function () {
gotoAndStop(5);
};
//Above is supposed to send action to frame 5
var frames:Array = [2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22,
23, 24, 25,
26, 27, 28, 29, 30, 31];
// Nrs. above are second frame to next to last frame.
stop();
//
this.button.onPress = function() {
var frameNumber:Number;
var n:Number = this._parent.frames.length;
if
{
var randomIndex:Number = Math.floor(Math.random()*n);
frameNumber = this._parent.frames.splice(randomIndex, 1);
} else {
frameNumber = 32;
//Nr. above is last frame.
}
this._parent.gotoAndStop(frameNumber);
};
//
Kenneth Kawamoto was kind enough to provide code for a random flashcard setup. See
I added a button to flashcard #1 to try to go from that flashcard to another frame where the answer for the flashcard would be (I arbitrarily used frame 5 to test the action, but in actuality the frame would be beyond the 32 frames dedicated to the flashcards).
My added code is shown as the first couple of lines of code below. When the button is pressed, nothing happens. I assume it has something to do with the other code. Is there a way to make the two sets of code work together?
Any help would be greatly appreciated.
Also, once one gets to the answer screen, what would be the button command to take the user back to the random screen they just left?
Thanks! Bill
// ActionScript 2
this.ans_button_1.onPress = function () {
gotoAndStop(5);
};
//Above is supposed to send action to frame 5
var frames:Array = [2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22,
23, 24, 25,
26, 27, 28, 29, 30, 31];
// Nrs. above are second frame to next to last frame.
stop();
//
this.button.onPress = function() {
var frameNumber:Number;
var n:Number = this._parent.frames.length;
if
var randomIndex:Number = Math.floor(Math.random()*n);
frameNumber = this._parent.frames.splice(randomIndex, 1);
} else {
frameNumber = 32;
//Nr. above is last frame.
}
this._parent.gotoAndStop(frameNumber);
};
//