|
-
tweenEvent / mouseEnabled error 1046 problems
I'm having a problem enabling a series of buttons by creating a function that occurs after a mouse/tween event and I keep getting 1046 errors as a result and can't find a proper solution. Here's my event:
function slide_right(e:MouseEvent):void
{
// Tween out the active slide
var galleryXTweenOut:Tween = new Tween(slides[showingIndex], "x", Strong.easeInOut, endX, -beginX, tweenDuration, true);
// Increment counter
showingIndex++;
// If the counter reaches the end of the slides then reset it to 0
if(showingIndex >= slides.length) navigateToURL(new URLRequest("packaging.html"), '_self');
// Tween in the next slide
var galleryXTweenIn:Tween = new Tween(slides[showingIndex], "x", Strong.easeInOut, beginX, endX, tweenDuration, true);
// Disable Buttons from working
rightArrow.mouseEnabled = false;
leftArrow.mouseEnabled = false;
}
OK, that function works. So now once this is all complete, I want to enable the buttons again so they work. My function is:
function enableButtons(e:TweenEvent):void {
rightArrow.mouseEnabled = true;
leftArrow.mouseEnabled = true;
}
galleryXTweenOut.addEventListener(TweenEvent.MOTIO N_FINISH, enableButtons);
And that brings up the 1046 error. Since there's no such thing as MouseEvent.COMPLETE, is there a proper fix to this?
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
-
No. Client won't let me. Just the code which is really all you need.
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
Upload a simple example of the problem.
-
I can't. I get a message that 'Your file of 1.45 MB bytes exceeds the forum's limit of 300.0 KB for this filetype.' and I can't make it any smaller.
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
Well, you can upload it to 'megaupload'.
-
Senior Member
You are declaring a local variable for the Tween in slide_right, which is not recognized outside the function. Declare the var outside all functions:
var galleryXTweenOut:Tween;
and later
galleryXTweenOut......(whatever here)
- The right of the People to create Flash movies shall not be infringed. -
-
cancerinform: I'll try your suggestion shortly. Sounds interesting.
Meantime, what is 'megaupload'? I've never heard of such of thing. Is that here on FlashKit? Or somewhere like YouSendIt?
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
 Originally Posted by databell
cancerinform: I'll try your suggestion shortly. Sounds interesting.
Meantime, what is 'megaupload'? I've never heard of such of thing. Is that here on FlashKit? Or somewhere like YouSendIt?
megaupload.com
-
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
Senior Member
I am sorry to say but those hosting companies where you can download things make life very difficult. I could not download any file.
- The right of the People to create Flash movies shall not be infringed. -
-
Here is the list of your problems:
1.You need to import the TweenEvent package, so add ‘import fl.transitions.TweenEvent;’
2.You must declare the Tweens instances outside of the function that uses it.
3.Both your Tweens for slide in and out functions have the same instance names. You need to have different instance names.
4.You need to add the 'TweenEvent.MOTION_FINISH,' listener inside both the Tween functions.
-
I've done steps 1, 2 and 4. Don't understand 3. Can you elaborate?
Still getting 1046 errors so since cancerinform couldn't get the megaupload files, I decided to post them to my clients' server. They can be found at:
http://www.designmg.com/new/flash/identity.zip
or
http://www.designmg.com/new/flash/identity1046.fla
http://www.designmg.com/new/flash/identity1046-2.fla
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
You have two of the same instances of "galleryXTweenOut" and "galleryXTweenIn" in the slide_right and slight_left functions.
Change the names of instances inside one of the functions.
-
So the variables have to be different for each function? so instead of just declaring:
var galleryXTweenIn:Tween;
var galleryXTweenOut:Tween;
I should declare:
var galleryXTweenIn:Tween;
var galleryXTweenOut:Tween;
var galleryYTweenIn:Tween;
var galleryYTweenOut:Tween;
And then maybe so as follows for slide_left?
function slide_left(e:MouseEvent):void {
// Tween out the active slide
var galleryYTweenOut:Tween=new Tween(slides[showingIndex],"x",Strong.easeInOut,endX,beginX,tweenDuration,tr ue);
// Subtract counter
showingIndex--;
// Tween in the next slide
var galleryYTweenIn:Tween=new Tween(slides[showingIndex],"x",Strong.easeInOut,- beginX,endX,tweenDuration,true);
galleryYTweenOut.addEventListener(TweenEvent.MOTIO N_START, disableButtons);
galleryYTweenIn.addEventListener(TweenEvent.MOTION _FINISH, enableButtons);
function disableButtons(e:TweenEvent):void {
rightArrow.mouseEnabled=false;
leftArrow.mouseEnabled=false;
rightArrow.alpha = .2
leftArrow.alpha = .2
}
function enableButtons(e:TweenEvent):void {
rightArrow.mouseEnabled=true;
leftArrow.mouseEnabled=true;
rightArrow.alpha = 1
leftArrow.alpha = 1
}
}disa
Because I tried that and it's still sticking. It's ignoring it seems to be ignoring the disableButtons and enableButtons functions.
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
It looks like your ‘disableButtons’ and ‘enableButtons’ functions are inside your ‘slide_left’ function.
Try putting the ‘disableButtons’ and ‘enableButtons’ outside of the ‘slide_left’ function.
-
Did that. Didn't change anything. Still getting the sticky problem and the functions don't seem to run.
I first place just disableButtons and enableButtons outside of the slide_left function and then when I found that didn't work, I also placed their addEventListeners outside of the slide_left function as well. Not just did that not work, but I got a #1009 error as well.
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
I think I got it solved!
I just uploaded a new version of the .swf and I think it's finally figured out. Was tricky so here's a play-by-play of what I did. But first, if you want to test it, go to http://www.designmg.com/new/portfolio/identity.html
First I declared four variables instead of two:
var galleryXTweenIn:Tween;
var galleryXTweenOut:Tween;
var galleryYTweenIn:Tween;
var galleryYTweenOut:Tween;
then in both the slide_left and slide_right functions, I added these actions:
rightArrow.mouseEnabled=false;
leftArrow.mouseEnabled=false;
rightArrow.visible=false;
leftArrow.visible=false;
So while the function is happening, the buttons are no longer visible. I originally set an alpha of .2 but I noticed that didn't work as well.
To the slide_right function I added under that:
galleryXTweenIn.addEventListener(TweenEvent.MOTION _FINISH, enableButtons);
Likewise to the slide_left function:
galleryYTweenIn.addEventListener(TweenEvent.MOTION _FINISH, enableButtons);
And then outside of both functions at the bottom of the script:
function enableButtons(e:TweenEvent):void {
rightArrow.mouseEnabled=true;
leftArrow.mouseEnabled=true;
rightArrow.visible=true;
leftArrow.visible=true;
}
Like I said, try it out on my link and that to both of you for helping out. Hopefully, no more sticking!
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
OK, one final issue. When I got to the end of the list of logos, I got this error message prompt:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at fl.transitions::Tween/setPosition()
at fl.transitions::Tween/set position()
at fl.transitions::Tween()
at identity_fla::MainTimeline/slide_right()
Where did that come from?
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
-
OK, now we got a new problem. It doesn't happen often but it does happen. a couple of times a tween will stop in progress and no longer move. Basically stopping the slideshow in its' tracks.
Adam Bell
[email protected]
--
Over 90% of all websites
suck......
Join the minority.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|