Expecto
Expecto

Reputation: 521

fading images - argument error

I am trying to write a quick bit that loads some images into an array and then loops through them, loading and then fading each one out. The error I am getting is..

ArgumentError: Error #1063: Argument count mismatch on images_fla::MainTimeline/goPlay(). Expected 0, got 1.

my code -

import fl.transitions.Tween;
import fl.transitions.easing.*;

play_btn.addEventListener(MouseEvent.CLICK, goPlay)

var images = new Array();

images[0] = "../1.jpg";
images[1] = "../2.jpg";
images[2] = "../3.jpg";
images[3] = "../4.jpg";
images[4] = "../5.jpg";
images[5] = "../6.jpg";
images[6] = "../7.jpg";
images[7] = "../8.jpg";
images[8] = "../9.jpg";
images[9] = "../10.jpg";

function goPlay() {
    for (var i:int = 0; i <10; i++) {
    loadWindow.source = images[i];
    var myTween:Tween = new Tween(images[i], "x", Elastic.easeOut, 0, 300, 5, true);
}
}

Upvotes: 1

Views: 61

Answers (2)

Boyd
Boyd

Reputation: 1165

you should be tweening loadWindow, not images[i] ... and and the e:Event like Srayer said

Upvotes: 0

Srayer
Srayer

Reputation: 128

You're missing an argument in goPlay()'s declaration. Event listeners are invoked with an Event object that contains data about the event that has been fired.

It should look like this:

function goPlay(e:Event) { ...

Upvotes: 1

Related Questions