Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-29-2006, 05:35 PM   #1
SteveAction
Registered User
 
Join Date: Mar 2006
Posts: 4
Default LoadMC, then set x and y position

I'd like a button click on release to load a movie clip on level 1. Since the mc is smaller than the main movie, I'd like to reposition the mc's x and y position lower down. The following Actionscript loaded the movie above the main movie, but it stayed in the upper left instead of in the coordinates I specified. Can you tell me what needs to be corrected?

on (release) {
loadMovieNum("movie_action.swf", 1);
setProperty("movie_action.swf", _x, "206");
setProperty("movie_action.swf", _y, "540");
}


Thanks,
Steve
SteveAction is offline   Reply With Quote
Old 03-30-2006, 01:16 AM   #2
Vache
Discontented Fame
 
Vache's Avatar
 
Join Date: Oct 2005
Posts: 50
Send a message via MSN to Vache
Default

Hmm, I would have loaded the swf in another mc with the loadMovie command then just set the _x and _y of the container MC.
Vache is offline   Reply With Quote
Old 03-30-2006, 01:24 AM   #3
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default

+ create an empty movieclip
+ position it
+ load its content
ActionScript Code:
on (release) {     _root.createEmptyMovieClip("mc_action", _root.getNextHighestDepth());     _root.mc_action._x = 206;     _root.mc_action._y = 540;     _root.mc_action.loadMovie("movie_action.swf"); }
sophistikat is offline   Reply With Quote
Old 03-30-2006, 02:44 AM   #4
oldnewbie
Banned by AS.org Staff
 
Join Date: Mar 2002
Posts: 10,533
Default

Doh! getNextHighestDepth() on a MX and lower only forum? You should know better!

You can't position a movie loaded on another level, until your sure it's fully loaded, and certainely not on the same actionscript as the loadMovieNum action itself...

The workaround in this case, is to preset the position within the "to be loaded" movie iself, by adding the following on it's first frame...

this._x = 206;
this._y = 540;
oldnewbie is offline   Reply With Quote
Old 03-30-2006, 01:48 PM   #5
sophistikat
Game On
 
sophistikat's Avatar
 
Join Date: Mar 2005
Location: Barrie, ON
Posts: 2,535
Default

Quote:
Originally Posted by oldnewbie
Doh! getNextHighestDepth() on a MX and lower only forum? You should know better!
as i was typing the script i was thinking 'i don't think getNextHighestDepth() works for MX' but then i thought 'if i'm wrong i can count on oldnewbie to prove me wrong'
ActionScript Code:
on (release) {     _root.createEmptyMovieClip("mc_action", 1);     _root.mc_action._x = 206;     _root.mc_action._y = 540;     _root.mc_action.loadMovie("movie_action.swf"); }
sorry Steve for the wrong script i should have tested getNextHighestDepth when i wasn't 100% sure and there's no excuse on my part... i do have flash 4, 5, 6, 7 & 8 installed at home.
sophistikat is offline   Reply With Quote
Old 03-30-2006, 03:40 PM   #6
SteveAction
Registered User
 
Join Date: Mar 2006
Posts: 4
Default

Quote:
Originally Posted by sophistikat
as i was typing the script i was thinking 'i don't think getNextHighestDepth() works for MX' but then i thought 'if i'm wrong i can count on oldnewbie to prove me wrong'
ActionScript Code:
on (release) {     _root.createEmptyMovieClip("mc_action", 1);     _root.mc_action._x = 206;     _root.mc_action._y = 540;     _root.mc_action.loadMovie("movie_action.swf"); }
sorry Steve for the wrong script i should have tested getNextHighestDepth when i wasn't 100% sure and there's no excuse on my part... i do have flash 4, 5, 6, 7 & 8 installed at home.

Thanks for all your help! That worked great. I need to put the movie in a mc in order to place the x y position. I'll keep learning! Now I'll add a button to unload the movie ...

Thanks,
Steve
SteveAction is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash Y position converted to Browser Scroll Position CookieDog ActionScript 1.0 (and below) 5 06-18-2007 10:46 PM
position and fade movieclip with delay deltasounds Animation and Effects 0 01-02-2006 10:35 PM
set position based on position?? Perlyman Simple Stuff (Newbies) 0 05-16-2005 04:10 PM
Sound position jlpetersen ActionScript 1.0 (and below) 1 12-16-2003 06:23 AM
Detecting drag and drop funkydesigner ActionScript 1.0 (and below) 4 04-11-2001 05:32 PM


All times are GMT. The time now is 11:37 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.