?
Solved

ActionScript 2.0 can't get variable of ActionScript 1.0

Posted on 2005-03-24
13
Medium Priority
?
190 Views
Last Modified: 2012-06-21
Hi experts, i have a main move(which had been written in AS1.0) which has a varaible _global.city;

Now i have made another movie written in AS2.0. I have an empty movie clip in my Parent movie and inside this empty movieClip im loading the new movie(with AS2.0). And in the new movie i have written trace(_root.city), it gives me undefined.....i even tried _parent.city..but no luck

I think it is a problem of AS verions, plz tell me any way to acces this variable. Its important
0
Comment
Question by:VBpassion
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 18

Expert Comment

by:Billystyx
ID: 13621360
try:
trace( _level0.city);

Billystyx
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13621376
Another thing you can do is when you test you main movie (so the other one loads into it), go to debug and look at the variables in the swf. Do a control-f search for city, and see what it is called in there. That's the reference you need to use.
(and it will probably be _level0.city);

Billystyx
0
 
LVL 2

Expert Comment

by:dravenPT
ID: 13621967
Hi there!

First, the solution:

- On the loaded movie, type

trace(_global.city);

It will work for sure!

Now, the explanation.

The problem here, is the scope. You have "two namespaces" for scoping in flash: the movie namespace, and a _global namespace. If a variable is created in a movie, you can only access it if you use the full path to the movie (movieclip namespace). But, if you use _global, then the variable isn't in any movie, but acessible for every movies.
For example, in the movie "_root.main.movie1_mc" you can make " _global.testvar=5 ". And, in the movie "_root.testing.anothermovie.andanothermovie.movie_5" you can type " trace(_global.testvar) ", and it will work! That's the purpose that _global exists: to make your vars acessible to every movie, without having to type full paths.

Hope this helps!

João

Sorry about my English, I'm Portuguese :D
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Expert Comment

by:Billystyx
ID: 13622272
Your english is better than mine:)

Billystyx
0
 
LVL 1

Author Comment

by:VBpassion
ID: 13623198
Hi folks,
Thanks for your reply, but I have tried what you said, _level0.city, it did not work.
ANd I also tried trace(_global.city), it doesn't work. This is the first thing which I had tried, but it doesn't work. Im sure this is something to do with ActionScript Versions.

Sine my parent movie is in version 1.0 , and my new child movie is in ActionScript 2.0, i think it can't access.

Please prove me wrong so that my problem gets solve.....i need this to be done. Help me Experts.
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13623465
Can you access anything from the _level0 from your loaded mc?
Billystyx
0
 
LVL 1

Author Comment

by:VBpassion
ID: 13627991
Hi Billystyx,
Now u got my problem, I cannot access any variable in_level0 from my loaded mc. I cannot get any value. It comes undefined.

So what do u say experts??.
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13628360
http://www.devarticles.com/c/a/Flash/ActionScript-2-0-Overview/4/

small amount of info here - there are differences and issues between the 2 - maybe the oreillys book will suggest ways to overcome. Aside from that - I haven't seen anything else helpful out there. sorry can't help further

Billystyx
0
 
LVL 6

Expert Comment

by:nishasrilankan
ID: 13642311
may be you are not initialized the variable at _root level....
or you may be get help from using mc._lockroot .. for the imported movie
http://livedocs.macromedia.com/flash/mx2004/main_7_2/00001522.html

0
 
LVL 1

Author Comment

by:VBpassion
ID: 13642366
Well thanx a lot guys, I have found the answer myself, its not possible. Reason being, the compilation of AS1.0 is totally different from AS2.0. Therefore  any variable of AS1.o is not readable by AS2.0.

I got this answer by contactin Macromedia themselves and asking them about my problem.

Macromedia said the answer is NO.

Thanx anyways experts
0
 
LVL 18

Expert Comment

by:Billystyx
ID: 13642570
sorry we couldn't help - but if MM says it cant be done then I guess it can't be done:)

Billystyx
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 15659707
PAQed with points (50) refunded

DarthMod
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

777 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