-
1. Re: Problem using tweens
Ned Murphy Feb 27, 2010 4:31 AM (in response to TorQue[MoD])The 1009 error indicates that one of the objects being targeted by your code is out of scope. This could mean that the object is not in the display list, doesn't have an instance name (or the instance name is mispelled), or it does not exist in the frame where that code is trying to talk to it, or that you animate the object into place but do not assign instance names in every keyframe for it, or you have consecutive keyframes of instances of the same objects with different names assigned. The last issue sounds like it night fit your story.
If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.
-
2. Re: Problem using tweens
TorQue[MoD] Feb 27, 2010 10:09 AM (in response to Ned Murphy)Thanks Ned, You seem to be the only on these forums that actually answers my questions! Adobe should hire you on as freelance tech support!
I thought that was the whole point of instances... to be able to place multiple copies of one object on stage and control them individually rather than have to create a new object for each one. If the problem is caused by using too many different instances of an object, would duplicating the object in the library and giving each one a unique name solve this issue?
I find it very odd that Flash would have a problem with too many instances as like I said I thought that was the point of them. Guess its not the same as an instance in 3D studio max?
-
3. Re: Problem using tweens
Ned Murphy Feb 27, 2010 10:49 AM (in response to TorQue[MoD])You can reuse objects as much as you please, no issue there. It's the placement of them in the timeline that can cause problems.
If the problem is what I suspect it is, it is a quirk of Flash that has been around for as long as I've used it. I am still not sure what I suspect the problem is is what your problem is, but it seems the most suspect. Here's how it goes...
Say you take an object from the library and place it in a frame and assign it an instance name. Then you add another instance of that same object from the library in the next frame (or some frame down the timeline without a break between the instances) and give it a different instance name. What happens is the second instance inherits some characteristics of the instance that preceded it, such as its instance name, regardless that you manually assigned it one of its own.
This problem more often manifests itself when people animate objects onto the stage... they neglect to assign an instance name until the button is in its final resting placce. The problem?... the lack of an instance name in the first frame(s) gets inherited by the one that was finally named at the end of the transition in, so whatever code was assigned to it won't work. The cure in this case is to name the instance at every keyframe.
But in the case I described ealier, the cure is to place empty keyframes between instances. If this isn't easily achieved due to an established design being in place, then a way around this is to alternate them on two layers so that you can place empty keyframes between them and still have them continuously present along the timeline.
-
4. Re: Problem using tweens
TorQue[MoD] Mar 2, 2010 7:50 AM (in response to Ned Murphy)Well I tried to come up with a work around the issue by duplicating the button in the library and re-naming each one down01-down08. I then placed these in the timeline accordingly and adjusted my code. I still get the same error...
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at website_fla::practitioners_mc_30/frame10()
at flash.display::MovieClip/gotoAndPlay()
at website_fla::practitioners_mc_30/clickDown01()Now the problem I have with these errors is as follows:
Cannot access a property or method of a null object reference always seems to come up when I name an instance wrong or basically I'm telling the code to do something with a named object that isn't actually in the timeline at that point. IE I either named the instance wrong, or I forgot to name it.
In this case, I've quadruple checked the names and this is NOT the case.
Second at website_fla::practitioners_mc_30/frame10() is telling me that there is a problem at frame 10 in practitioners_mc_30. I don't have a file named practitioners_mc_30. I have a file named practitioners_mc, so why is there a 30 being appended to the file name?
Third, at website_fla::practitioners_mc_30/clickDown01() again the mc name is practitioners_mc without the 30 and then the really strange part, its telling me that there is a problem with clickDown01... on frame 10 in the timeline, I'm nolonger referencing clickDown01, I'm referencing clickDown02.
Code Sample from frame 10 in practitioners_mc stop();//Billa Page Tween Class Code
var BillaTween:Tween = new Tween(billa_mc, "y", Regular.easeOut, 680, 0, 1, true);
//handle button events
down02.addEventListener(MouseEvent.CLICK, clickDown02);function clickDown02(evtObj:MouseEvent){
gotoAndPlay ("Janet");
}Now this code is based on code from a lynda.com tutorial. I've been using it for basically the entire website without issue until now, so there must be something that I'm missing...
Here's the original code:
Lynda.com original code: stop();//Home Page Tween Class Code
import fl.transitions.Tween;
import fl.transitions.easing.*;
var HomeTween:Tween = new Tween(home_mc, "x", Elastic.easeOut, 955, 0, 3, true);
//handle button events
home_mc.fighters.addEventListener(MouseEvent.CLICK, clickButtons);
home.addEventListener(MouseEvent.CLICK, clickButtons);function clickButtons(evtObj:MouseEvent){
trace ("The "+evtObj.target.name+" Button was clicked!")
gotoAndStop (evtObj.target.name);
}Now the only thing I can think of is that I'm calling all of this code inside practitioners_mc and in the code I'm simply calling billa_mc instead of practitioners_mc.billa_mc. The reason I'm doing this is because I figured the code is only being called inside practitioners_mc and not in the main timeline. Do I need to add the practitioners_mc. reference too or am I calling the code properly?
As far as I can see, everything I am doing is correct and the exact same way I've done the entire website so far, so I don't see why this error is repetedly occuring.
Thanks!
-
5. Re: Problem using tweens
Ned Murphy Mar 2, 2010 8:11 AM (in response to TorQue[MoD])The best I can offer for any of the problems is that you must be missing some things.
If an error message is telling you about something you say doesn't exist (clickDown01), it can't make that stuff up, so it has to exist somewhere. If it's a compiler error, you should be able to locate it directly by selecting the error and clicking the View Source button in the error window. If it's an output error message thtat feature isn't offered (would be nice).
As far as the _30 goes, accept it as something Flash does and don't try to relate it to your code. If I ever come to realize what it is supposed to be identifying (like a line number or something) then I can offer better info on interpretting it. Take the part of it you you do recognize as an indication of wherein the problem arises.
-
6. Re: Problem using tweens
TorQue[MoD] Mar 2, 2010 8:48 AM (in response to Ned Murphy)clickDown01 does exist, I just said it doesn't exist at frame 10. Its at frame 0.What I don't understand is why is it telling me there's a problem with clickDown01 if when I run the movie, its actions work, take me to the second keyframe in the timeline (frame 10) and THEN breaks.Can you see anything wrong with this code?//handle button events
down01.addEventListener(MouseEvent.CLICK, clickDown01);function clickDown01(evtObj:MouseEvent){
gotoAndPlay ("Billa");
}I call the clickDown01 event then I specify the clickDown01 function. Like I said, I've been doing this the entire website. I'd love to have someone point out to me that I'm an idiot and I just typed something wrong, or named something wrong, but I really can't find where.Its happening during output not compile. There are no errors during compile.Ok, I figured the _30 might just be flash doing its own thing, but I thought I'd check.Maybe the problem is the functionality of the button I created? I made a movie clip called down_arrow that has the arrow graphic animated in the timeline to look as if its bouncing up and down. Then I dragged this onto the stage and converted it to a button called down_01. I then duplicated the button 7 times and renamed them down_01 - down_08. In the practitioners_mc, I dragged the buttons onto the stage at frames 0,10,20 etc. up to frame 70 and gave them all an instance name of down01 - down08. At each keyframe (0,10,20) I call the same code above and simply rename each MouseEvent clickDown01, clickDown02 etc. and then rename the function appropriately.Is there maybe a problem with the fact that I'm recycling the code so much and only appending a number to the end of each event/function?


