473,396 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

target right back to the _root from inside movie clips??

elamberdor
Hello All!
Well, I can load in swf's just loverly, but what I have is a sliding menu, with buttons in it, that when pressed, load an image into an empty movieclip.

I really just need to know how to target back to the _root of the whole movie.

It works great when the buttons and empty movieclip in the same stage or same movie clip, however I need to work out the right script to target right back to the root where i want the image to sit, from a button, inside a movie clip. I have the jpegs in both the swf folder and inside the flash file.

The reason I need the buttons and the img_container separate is because if you slide the buttons left or right in the sliding menu, the image slides across as well.

Here is what works when they are within the same movie clip:

on (release) {
loadMovie("lamp1.jpg", "img_container");
_root.img_container._xscale = 40
_root.img_container._yscale = 40
}

...however i'm trying to use target path, and it's not working too well...

on (release) {
loadMovie("lamp1.jpg", "img_container");
this.img_container._xscale = 40;
this.img_container._yscale = 40;
}

Any ideas, or how I could better structure this would be wonderful!
Thanks!
Aug 7 '07 #1
10 4870
Hey All!

Ok, I got it to work!
I thought I would post the answer here! =)

Basically the answer was sticking my img_container ( the movie that load in images..) into another movie placed on the _root.

so:

on (release) {
loadMovie("lamp1.jpg", "_root.staticI.img_container");
_root.staticI.img_container._xscale = 40;
_root.staticI.img_container._yscale = 40;
}

just took it straight off the root, and it worked!
yay! =)

*one problem with this site ticked off the list! =P *
Aug 7 '07 #2
xNephilimx
213 Expert 100+
Great that you have that working.
An advice that' will be usefull for you and for everyone:

don't use the _root, cause if the movie that is using _root as reference is for some reason loaded inside another movie the _root will be referencing that other movie, try this, make a variable named home (for example) and make it equal to this (the pseudo-element "this" I mean). So the home object will be now the current root element and you'll avoid nesting problems. Also you can call this home object from wherever you like and will still be the root of your movie. even if your movie is being called inside another one.

Expand|Select|Wrap|Line Numbers
  1.  
  2. var home:MovieClip = this;
  3.  
  4.  
Kind regards.
Aug 9 '07 #3
Thanks xNephilimx,

Funny your should mention that, this movie is actually going to sit within another main movie to cut loading, and that's exactly the problem i'm having!

I'm not too familiar with var.script, But know I know where at least i'm going wrong! I'll have a bit of a play!

Thanks Heaps!
=)
Aug 23 '07 #4
xNephilimx
213 Expert 100+
Lol, you're welcome, that's one of my main advices, because it really helped me a lot to always refer to the local root with a variable, and I know it's a common problem.
Well, now knowing where you're wrong it's a pretty good start, I'm always around the actionscript forum, so any doubt you might have post it here and I or other experts will try to help.

Kind regards and good luck with your projects,
The_Nephilim

Thanks xNephilimx,

Funny your should mention that, this movie is actually going to sit within another main movie to cut loading, and that's exactly the problem i'm having!

I'm not too familiar with var.script, But know I know where at least i'm going wrong! I'll have a bit of a play!

Thanks Heaps!
=)
Aug 23 '07 #5
Hello Again!

Well, i've had a bit of a search around, found a good tut about var home here at
studio koi
and I've given that a go on a button that calls to an image container inside another movie:
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     var home:MovieClip = this;
  3.     loadMovie("images/image.jpg", "_root.staticI.img_container");
  4. }
  5.  
works on it's own when using that "_root." you see there, however called into another movie clip not so well. I've tried:

Expand|Select|Wrap|Line Numbers
  1. "home.staticI.img_container");
  2. and
  3. "this.staticI.img_container");
  4.  
But i'm pretty sure i'm missing the mark and i'm soooo close!

Because my sliding buttons no longer work:
they use:(left arrow example)
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     targetx = 360;
  3.     script.gotoAndPlay("move");
  4. }
  5.  
("move" being a frame label in a hidden "script" movie clip)
it may have something to do with the movie dimensions though....

But my main focus is on properly writing that "home" link......
Any ideas!? =)

Lol, you're welcome, that's one of my main advices, because it really helped me a lot to always refer to the local root with a variable, and I know it's a common problem.
Well, now knowing where you're wrong it's a pretty good start, I'm always around the actionscript forum, so any doubt you might have post it here and I or other experts will try to help.

Kind regards and good luck with your projects,
The_Nephilim
Sep 3 '07 #6
Alrighty,

Well, it seems to be working now:
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     var home:MovieClip = this;
  3.     loadMovie("images/image.jpg", "_root.staticI.img_container");
  4. }
  5.  
same code, just re-did it....*hrmm*

that's on the actual button of the call in movie, now in the main timeline, i've got the button that load this swf to say:
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     var home:MovieClip = this;
  3.     loadMovie("lighting.swf", "_root.swf_loader.swf_container");
  4. }
  5.  
as well...
(yay! doing a bit of a happy dance right now!)
(sorry i'm not really the serious forum type! =P)

sliding buttons still load well too.... exact coordinates too...
Thanks as always!!!!
=)
Sep 3 '07 #7
xNephilimx
213 Expert 100+
LOL
Glad you had it working!
Another way to do that is by using the target movieclip you want to use as a loder and from it using the loadMovie method, like this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. home.mc1.mc2.etc.loadMovie("path/to/file");
  3.  
  4.  
That way you safely use the home var, and have no problems when using this movie inside another one.

Anyway, it's good to see users here that actually put effort in solving their problems by themselves. Have no doubt when you need something you can't figure out that I'll try to help as much as I can.

Best regards,
The_Nephilim

Alrighty,

Well, it seems to be working now:
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     var home:MovieClip = this;
  3.     loadMovie("images/image.jpg", "_root.staticI.img_container");
  4. }
  5.  
same code, just re-did it....*hrmm*

that's on the actual button of the call in movie, now in the main timeline, i've got the button that load this swf to say:
Expand|Select|Wrap|Line Numbers
  1. on (release) {
  2.     var home:MovieClip = this;
  3.     loadMovie("lighting.swf", "_root.swf_loader.swf_container");
  4. }
  5.  
as well...
(yay! doing a bit of a happy dance right now!)
(sorry i'm not really the serious forum type! =P)

sliding buttons still load well too.... exact coordinates too...
Thanks as always!!!!
=)
Sep 3 '07 #8
Well, I find nothing worse when i'm searching for answers that the original poster hasn't come back with their solution...! I try to when I can!

You have been extreamely helpful with your code snippets & easy to understand language!

Thanks again as always!
=)
Sep 3 '07 #9
ghert
1
thanks guys! i have been having the same problem this entire day and then i stumbled updon this! thanks so much! even though its 2 years later! cooool
Apr 21 '09 #10
yay! the internet works! =D
Apr 24 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: yama | last post by:
i have 4 movie clips. i am able to run the first clip with autostart a soon as the webpage opens. i am running the movie clips under window media player. Question 1:i want to run all the movie...
3
by: torchestra | last post by:
I have several movie clips and would wish to play them in sequence. There is possible to use the SetQTNEXTUrl property for the quicktime plugin, but it creates a black gap between the clips. Is...
1
by: =?Utf-8?B?QWRhcnNo?= | last post by:
Hello all, I am designing an appliaction to stream video from video server in vc++6.I have created buffer for storing the bitmap bits of video in application.Can i create .wmv movie clips from...
2
by: =?Utf-8?B?SG9sbHk=?= | last post by:
Please help...I'm trying to make a movie of different clips. I can add a set of clips from one collection to the storyboard and it plays fine. Then I will add another set of clips from another...
2
by: teenIce | last post by:
Hi all, Please help me with this problem. I'm new in flash and actionscript, sorry if my question is too easy. I have a variable name _root.test at Scene 1, and I have a movie clip name Answer,...
1
elamberdor
by: elamberdor | last post by:
Hi All! Have a complex roll in / roll out button (ag_mc) that unwraps, then re-wraps a chocolate upon roll in - roll out. However - to complicate things, I would also like another button ( ag_desc)...
2
by: robtyketto | last post by:
Greetings, I have workable code to allow movie clips to be dragged around. However I can't find an example of a drag n drop where the movie clip has to be placed with a certain range/xy...
1
by: manxman | last post by:
Guys and Gals, AS2 do you know if its possible to drag a movie from one clip into another clip? I know I can do it by having two same drags, one in movie A, and the other in movie B. But is...
0
by: sarakmak | last post by:
Hi, I have 3 movieclips on the main stage. btn1, 2, 3 I have this code in the maintime line, that when i click a button, the btn the stays static (like its on), when i click another btn, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.