Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > Simple Stuff (Newbies)

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-07-2012, 12:08 AM   #1
BritJ
Registered User
 
Join Date: Jun 2012
Posts: 3
Default Confining SWF to a MovieClip in AS3

I've been searching everywhere, and I can't find an answer to this problem. I'm making a portfolio site for myself, and I'm a total newbie to AS3. I've only had a few problems that I was able to iron out myself through searching, but this has taken me a couple days.

What I want to be able to do is take a gallery I made in Bridge and import the SWF so that it is confined to the size of my predesignated movieclip background. The SWF loads perfectly, it's just that I have navigation at top, and the SWF wants to fill the whole stage. If it does, then everything else gets blocked out.

My code is really simple right now:

var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("viewer.swf");

myLoader.load(url);
addChild(myLoader);

myLoader.x = 0;
myLoader.y = 0;

How do I fix it so that it only loads up confined to the size of my movieclip, which I'm calling galleryMC?
BritJ is offline   Reply With Quote
Old 06-07-2012, 01:11 AM   #2
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,332
Default

Try something like this:
ActionScript Code:
var gallery:MovieClip = loader.content as MovieClip;// the loaded swf gallery.width = galleryMC.width;// set the width of the gallery gallery.scaleY = gallery.scaleX;// scale proportionally galleryMC.addChild(gallery);// add the swf to galleryMC
[afz]snickelfitz is offline   Reply With Quote
Old 06-07-2012, 01:46 AM   #3
BritJ
Registered User
 
Join Date: Jun 2012
Posts: 3
Default

I just added it to my code, and I got an error with this line:

var gallery:MovieClip = loader.content as MovieClip;// the loaded swf

The error read - 1120: Access of undefined property loader.
BritJ is offline   Reply With Quote
Old 06-07-2012, 02:13 AM   #4
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,332
Default

Change it to myLoader or whatever you named the loader instance.
[afz]snickelfitz is offline   Reply With Quote
Old 06-07-2012, 03:06 AM   #5
BritJ
Registered User
 
Join Date: Jun 2012
Posts: 3
Default

It loads up, but it still isn't keeping it on the movieclip. I know this is an error on my end, and I'm trying to think of what I didn't do.
BritJ 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


All times are GMT. The time now is 11:51 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.