Solved

I get Error 1120 in Flash CS3 even though the code references a correctly named movieclip instance on the stage...

Posted on 2008-10-10
14
579 Views
Last Modified: 2013-11-12
Hello - I am using Flash CS3.  When I test the movie, I get error code 1120 - access of undefined property.  The code references a movieclip (instance name SJH) and is attached to frame 1 AS of a separate movieclip (jk1_btn) that acts as a button.

The movieclip SJH is also on stage at frame 1 (and it plays a slide show for 75 frames or until one of the buttons is clicked to play a video).

The offending code (SJH._visible=false;)  is in the function below (though I was surprised that the error message is thrown immediately not when the function is called).

Any ideas why the error occurs?

Thanks!


jk1_btn.addEventListener(MouseEvent.CLICK, vid1);

function vid1(e:Event):void {
      SJH._visible=false;
      vidPlayer.source = "jenvid.flv";
}
jk2_btn.addEventListener(MouseEvent.CLICK, vid2);

function vid2(e:Event):void {
      SJH._visible=false;
      vidPlayer.source = "SJH_Rendering1.flv";
}
0
Comment
Question by:ewv1
  • 7
  • 6
14 Comments
 
LVL 9

Accepted Solution

by:
asaivan earned 125 total points
ID: 22691544
In AS3, properties are no longer prefixed with the underscore.  Thus SJH._visible is now SJH.visible.
0
 

Author Comment

by:ewv1
ID: 22703909
Thanks for checking over the code for me.  However, I have tried SJH.visible as well.  The real issue is the Error 1120 message...if AS code references an object by the instance name on a frame that is after the object has been moved on the stage, then why would this error occur?  

I tried accomplishing it using object-oriented code as well, placing the FLVPlayer on stage at a certain x and y coordinate after a movie clip of tweened images (basically a slide show type intro) had run, and again I got the Error 1120.
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22704165
It sounds like a typical Asynchronous error, are you sure all your clips have been added to the stage before the code is called?
0
 

Author Comment

by:ewv1
ID: 22704465
Yes, the movieclip of instance name SJH is on the stage from frame 1.

I get the same error 1120 when I try the code below (where jk1_btn is a movie clip that acts like a button) - however the undefined property is jk1_btn in this case.  But in the example from my first post, jk1_btn is recognized (but movieclip SJH is not).

Maybe I am missing something conceptually?

Thanks again for any advice or insight

function m_over(e:Event) {
      jk1_btn.gotoAndPlay("in");
}

jk1_btn.addEventListener(MouseEvent.MOUSE_OVER, m_over);

function m_out(e:Event) {
      jk1_btn.gotoAndPlay("out");
}

jk1_btn.addEventListener(MouseEvent.MOUSE_OUT, m_out);

0
 
LVL 9

Expert Comment

by:asaivan
ID: 22704875
In your MovieClip properties, do you have them set up for export to ActionScript?
0
 

Author Comment

by:ewv1
ID: 22704993
Yes.  MovieClip SJH is the name for an instance of SJH_1 - which is in the library and is set to export to AS.
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 9

Expert Comment

by:asaivan
ID: 22705150
Well, if you want I can look at your FLA file?
0
 

Author Comment

by:ewv1
ID: 22705309
That would be great!  

Should I zip it and attach here or send to you?

Thanks again for your time.
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22705514
you can send it to spiritualresponse@gmail.com
0
 

Author Comment

by:ewv1
ID: 22705696
I e-mailed the file (9 MB).  It has not bounced back, but if it's too large for your e-mail acct, I will download  WinZip, zip it and re-send.
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22705857
For whatever reason, I'm not getting that error.  I don't know why, but it's not happening for me.  Actually, I got the error once, then when I tested again it didn't show.  So I redownloaded the app from email, but I still didn't get the error, it's starting to sound more like a Flash IDE bug...
0
 

Author Comment

by:ewv1
ID: 22705996
OK - so maybe I should just build a new FLA file?  I'll do a search for IDE bugs to see what I find.  

Unless you have other ideas...

Once again, thanks so much for your time and willingness to help.
0
 
LVL 9

Expert Comment

by:asaivan
ID: 22706101
No Problem.  What you might try is indeed copying and pasting all of your data into a new Flash file...something weird is up.  I've had problems like that before where some bit isn't happy and is causing a rebellion somewhere in the program ;)

Try it and let me know how it goes.  
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now