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
582 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

930 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

9 Experts available now in Live!

Get 1:1 Help Now