ActionScript 3.0 :: Cropping Externally Loaded SWF To Stage Bounds?

Jul 27, 2009

When using the Loader class to load an external SWF into another timeline and then displaying that SWF using addChild on the loader.content, one discovers to one's consternation that elements positioned off the stage of the external SWF are still displayed.To illustrate this with an example: suppose you have a 500x500 pixel "main" SWF, and it loads an external SWF at runtime and positions it in the center of the stage. And suppose that this external SWF's document properties set the stage width to 200 x 200 pixels. However, when authoring this external SWF, we draw a box that's 300 x 300 pixels, so part of this box is actually off-stage.

When you play the external SWF in the standalone Flash player, it is sized correctly at 200 x 200 pixels, and the rest of this box is cropped off.When you load this external SWF into the "main" SWF and use addChild() to put it on the stage, you will see the full 300 x 300 pixel boNow of course, we can simply solve the issue using a mask, but I'm wondering whether there's a more elegant solution that's built in, either to the MovieClip or the Loader or the LoaderInfo classes. Something that says "respect the document bounds of the original SWF" or "crop to stage dimensions".

View 1 Replies


Similar Posts:


Flash :: Rotate BitmapData When Using Draw Method. Width Height Bounds Clipping / Cropping?

Jan 29, 2010

I wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision.It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations don't get registered in the draw method. So what I did was pass through a Matrix in the draw method. That works. But here's the actual issue. If I output the BitmapData to a Bitmap on the stage, I see that Bitmap is, in fact, rotating, but now it's exceeding the bounds (width and height) of the BitmapData. Which is cropping / clipping the image of the source MovieClip.

UPDATE: Basically, when the Bitmap clone of the MovieClip rotates outside the positive co-ordinate space, it doesn't get drawn. It rotates outside the bounds of the BitmapData set width and height. I can multiply the bounds by 2, and then center the bitmap inside the set bounds, but then the origin point is never fixed and the object is always being moved around. Works pretty well, but makes aligning the object to any specific point impossible.Here's my isolated test code. It requires you to have a MovieClip on the stage named "iTest". I used a fairly vertical arrow shape (higher than it is wide) so I could keep track of rotations visually accentuate the clipping problem:

var rotateTimer:Timer = new Timer(10);
function rotateObject_init():void
{

[code].....

View 2 Replies

ActionScript 3.0 :: Accessing Stage Of Externally Loaded Swf?

Jul 22, 2009

I am loading an SWF created in Flash CS4, using the 3d translation tool.The SWF is being loaded into an application being build in as3 in flex builder 3.I can manage to load the movie however the stage has disappeared. All of the objects that exceed the boundaries of the (banner) remain visible instead of being cropped by the stageI attempted to mask the swf before publishing which did not work, and I attempted to programmatically assign a mask once it was imported which also did not work.None of these options threw errors, in most cases they either had no effect whatsoever or the movie simply disappeareI've read numerous posts on this and the answers always seem to be vague.Based on my research I need to access the stage properties of the SWF being loaded, but am unsure how to go about it.Do I need to compile the movie, export a swc and add it to the build path for the project?Do I HAVE to use a document class for the SWF I want to load in order to access it?Do I need to add anything else to the source or build path for the project in Flex Builder?

View 5 Replies

ActionScript 3.0 :: Stage Access Of Externally Loaded Swf's?

Aug 27, 2009

I have a Flex project where I am loading in 3 external swf's. Each of these swf's represent their own projects, each with its own stage. In each of these sub-projects I reference their stage from within, but this does not work once they are loaded into the Main.

I eventually got the contents to display, realizing that stage will return null unless ADDED_TO_STAGE is complete in externally loaded swf's. Unfortunately the way I did it, I am now adding to the Main's stage instead of the swf's stage.

Code:
public static var mainStage:Stage;
public function Program()
{

[Code].....

I assuming that even though i'm in Program.swf, this.stage is still referring to the parent swf?

View 3 Replies

ActionScript 2.0 :: Get The Stage Dimensions Of An Externally Loaded Swf Through Moviecliploader?

Feb 9, 2009

Code:
var container:MovieClip = createEmptyMovieClip("container", this.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);[code]....

This always traces the width/height of the content of the external crossball.swf file, not its stage dimensions. So let's say crossball.swf has a document size of 200 by 200 pixels and in it is a shape of 115 by 30 it will trace the last as the width/height of 'container'.Is there any way to get the stage dimensions of an externally loaded swf through moviecliploader?

View 1 Replies

Actionscript 3 :: Externally Loaded Swf To Control Stage And MovieClips And Their Children?

Mar 10, 2012

I have 2 swf files. One is loaded and loading an externally loaded swf into it.Here is the code in the first loaded swf: #1

var logo:Loader = new Loader();
logo.load(new URLRequest("images/Logo.png"));
logo.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadLogo);
function LoadLogo(e:Event):void

[code]....

EDIT:I am having major SANDBOX issues now when I make the clip load from an external URL. I am also coding for an ANDROID using FLASH CS5.5. Its not allowing me to use Security.allowDomain("*");

View 1 Replies

Professional :: Make The Stage Height Shorter By "cropping Out" The Bottom Portion Of The Stage?

Sep 21, 2010

Right now my stage dimensions are 980 X 800 px. I need to cut or "crop out" the bottom portion of the footer because its height is too long. So I changed the stage dimensions to 980 X 600 px (and changed the corresponding dimensions in the embed tag in the index.html file to match). Doing this seems to cut out the bottom but at the same time adds space to the top and seems to distort the overall spacing. Is there a simple way to crop out the bottom of the stage (just like cropping out a section of a photo)?

View 5 Replies

Professional :: Mask Layer Not Working In Cropping To Stage Flash

Apr 1, 2010

I've read through umpteen Flash threads of frustrated users who export SWF and anything visible outside the stage appears in the SWF when opened in a browser.None of the solutions have worked for me.My file is called statement_onlineheader.fla.URL...I have my mask layer above a folder containing all other layers.I have also tried moving the mask layer above individual layers.Stuff outside the stage appears in the exported SWF.

View 5 Replies

ActionScript 2.0 :: Tell If Something Is Within The Stage Bounds?

Jun 23, 2009

I have a bunch of images going on all at once, some on the stage, and some off, and i would like to find a way of telling whether or not they are currently on the stage or not....

I know i can do the whole

checkStage = function () {
if ((mc._x>=0) && (mc._x<=Stage.width) && (mc._y >= 0)&&(mc._y >=Stage.height)) {
//have mc do whatever here

[Code].....

that way i can satisfy my laziness AND achieve what i'm trying to do without having to deal with long winded paths and a bunch of else if's

View 1 Replies

Actionscript 3.0 :: Get Bounds Of A Rectangle On Stage

Apr 30, 2009

I have a simple MC on the stage. I want to create a simple conditional statement that would check if the mouse is on the rectangle using get bounds. something like [code]Basicaly...how do I properly use the getBounds in a situation like this?

View 3 Replies

ActionScript 2.0 :: Preloading Flashvars - Ensure That All The Content Being Loaded Externally Is Loaded Before The Transition Plays?

Aug 30, 2005

I am in the process of building a site for an Architect... Jamie Fobert Architects (projects) I am useing transitions between the projects and am loading details/text and images externally through flashvars, php and a mySQL database. Within my transitions I have a a preloader on the forst 2 frames the code is as follows (taken from a Voetsjoeba tutorial):

[Code]....

This works pretty well if the content is within the .swf, but when it is loaded externally it doesnt preload it at all. Does anyone know how I can adapt/improve this preloader? or somehow ensure that all the content being loaded externally is loaded before the transition plays?

View 2 Replies

ActionScript 2.0 :: Setting Bounds For MovieClip On Stage In Flash?

Jun 9, 2006

I have a "circle_mc" movie clip and its registratoin is in the center but it moves and works fine but i dont want it to go off the stage half way I want it to stop before it goes off

ActionScript Code:
circle_mc.onRollOver = function() {
this.dx = Math.round(Math.random()*Stage.width);
this.dy = Math.round(Math.random()*Stage.height);
this.onEnterFrame = moveIt;
}; function moveIt() {
this._x += (this.dx-this._x)/10;
this._y += (this.dy-this._y)/10;
if (Math.round(this._x) == this.dx) {
this._x = this.dx;
}}

View 4 Replies

Actionscript 3 :: Display Objects Outside Of Stage Bounds Still Get Rendered By Flash?

May 7, 2010

If an object exists outside of Flash's stage boundaries, is on the Display List, and is visible, is it causing a performance hit from Flash rendering it? In other words, does Flash render what isn't seen?

This leads me to believe so:
http://stackoverflow.com/questions/170203/how-do-you-make-flash-not-render-an-object-on-the-stage

View 1 Replies

ActionScript 2.0 :: Externally Loaded Swf Does Not Stay Loaded?

Feb 16, 2006

I am loading an externally loaded swf that uses a mask to transition in. When the user clicks a different button I am doing a gotoAndPlay that goes to a mask that "unloads" the content (it doesnt actually unload the info is just outside of the mask area. As soon As I jump to that section the movie is no longer loaded and just shows the container clip that I had created for it. The Container Clip is never changed and is the same throughout the whole process. The only thing that changes is the mask animation.I have tried both loadClip and loadMovie but no luck on keeping the clip loaded.

EDIT - I have narrowed it down. When I change the mask movieclip the movie unloads for some reason. Is there a way I can keep it loaded?

View 2 Replies

ActionScript :: Flash - Continuously Dragging Objects Within Bounds From Off-Stage Mouse Coordinates?

Jul 2, 2010

is it possible for flash to detect off-stage mouse coordinates in order to continuously drag an object within its bounds while the mouse is moving outside of the stage? for example: i have a draggable red square on my stage. the stage is the bounds of the drag. if i drag the red square to the bottom of the stage and continue to drag outside of and around the stage, i'd like the red square to continue moving within it's bounds, following the mouse coordinates. currently, dragging halts as soon as i leave the stage and the red square only begins to move with the mouse coordinates if i reenter the stage bounds.

View 2 Replies

Actionscript 3 :: Stopping An Externally Loaded Swf From "playing" When Another External Swf Is Loaded?

Nov 8, 2011

I have a homepage with five "links" to each swf. Now the first swf I have a custom cursor that hides the mouse. When I click on that link it plays and when I quickly go to the homepage again it hides the mouse there when it's not supposed to do it.

Same with every other link. When I was busy with the first swf and want to go to the last swf of the five, my mouse just disappears! It is almost as if it keeps on "playing" without seeing the swf...

Here is the code that I have so far!

var currentpage:uint = 0;
//one loader object per project:
var loadingobject1:Loader = new Loader();
loadingobject1.x = 445;

[Code]....

View 1 Replies

Resizing Externally Loaded SWF?

Dec 23, 2009

i'm having some "big" issues with what seems like a pretty easy flash concept. But, im pretty green when it comes to coding in flash.

I have a SWF thats being externally loaded into another SWF file (see code below):

on(release) {
loadMovie("test1.swf",_root.dropZone);
}

(If i'm understanding the above code correctly...its loading the SWF into a blank MC i created called dropZone) This part seems to work correctly when tested.

I've got 4 different SWF's that need to be loaded seperatley when its coresponding button is clicked. The issue arises when I import the external SWF file...it resizes itself to the size of the flash stage. I need all the SWFs to be loaded and remain there original size (1257x847) or be scaled to the correct size. Then if I click another button it should load the new SWF and "unload" the old SWF.

View 3 Replies

Loader For Externally Loaded SWF?

Dec 2, 2009

if a loader can be added to let the user know the video is being loaded rather than a blank 20-30 seconds...

View 18 Replies

Xml :: Order Of Externally Loaded Swf?

Feb 10, 2010

I'm loading swf's via an XML file. I'm wanting them to be added onto the stage in the same order that they appear in the XML. The problem that I'm having is that they are added to the stage only when they are fully loaded.

This is my xml (_config.xml)

<campaign>
<component SWFsource="logo.swf"/>
<component SWFsource="gallery.swf"/>

[code].....

View 3 Replies

IDE :: Loader For Externally Loaded SWF?

Dec 2, 2009

I have a fairly chunky swf that I am loading through the loadMovie function. Just wondering if a loader can be added to let the user know the video is being loaded rather than a blank 20-30 seconds...

View 1 Replies

ActionScript 2.0 :: Mouse Scroll The Entire Map Mc Inside The Bounds Of The 500px X 500px Stage

Aug 14, 2007

I have my stage set at 500px x 500px. I have a map mc on stage that is 2500px x 2500px and I am trying to mouse scroll the entire map mc inside the bounds of the 500px x 500px stage. The map mc xy ref coordinate is in the center of the graphic. This is a math problem for me. An example would be [URL]

View 1 Replies

ActionScript 3.0 :: Get "on Stage" Bounds Rectangle Of Xyz Rotated Sprite

Dec 28, 2011

i cant get "on stage" bounds of sprite that rotated in 3d space

Code:
var draggableContent:Sprite=new Sprite();
var _3dContent:Sprite=new Sprite();
var _child3D:Sprite=new Sprite();

[Code]....

View 0 Replies

ActionScript 3.0 :: Remove .flv From Externally Loaded .swf?

Aug 7, 2009

With the assistance of a very kind member of this forum, I have got as far as getting an .FLV to load into my API via its own .SWF.

[URL]

click on "Animalia - Verse from the Zoo" to load the VideoPlayer .swf which contains the .FLV

I will add more functionality when I've solved this. Now that I have a Video Player which closes, the next set of hurdles to overcome are these:

Click "Close" with the .FLV playing and the sound keeps playing because the .FLV is still playing. Click "Close" with the .FLV paused and when you call the player back, it plays from the same spot. So, my tiny brain says it's an "add/removeChild" issue. Obviously when happy user clicks "Close" and then re-loads by clicking "Animalia", happy user wants the video to play from scratch. That's what I want, anyway. Not from where it left off after clicking "Close". I've made several attempts at adding a "remove FLV" object to the function and Event Dispatch method, but what I did is wrong because the code I put in removed the .FLV permanently and when you call the player back by clicking on "Animalia", the .FLV does not play at all. I'm going round in circles looking for the correct NetStream/removeChild/unload.nsplay/etc/etc .. AS3 coding and where to put it.

My .FLV video load object on "NewPlayer.swf" is:

var myVideo:Video = new Video(360, 264);
addChild(myVideo);
var nc:NetConnection = new NetConnection();

[Code].....

My questions is:- What is the correct coding to get the VideoPlayer .swf to unload its .FLV completely, SO THAT when a user clicks "Close". Either with or without the .FLV playing, everything closes completely and when re-loaded, the video plays from scratch?

View 2 Replies

ActionScript 2.0 :: Pause Externally Loaded Flv?

Sep 16, 2009

I am externally loading an flv into an empty movie clip container using loadMovie into a main swf. The flv is in a standard flv playback component and works fine on its own. But what I'd like to be able to do is pause the flv when any of the buttons in the main swf are pressed.

View 7 Replies

ActionScript 1/2 :: Control An Externally Loaded SWF?

Jul 26, 2009

I'm working on an flash movie and the interface is a small town (simiar to "doritos.com" and "comcasttown.com") if you reference both the doritos and comcast sites their little movie runs smoothly. I have several elements in the town. For example, one of the elements is an airplane hangar. When you rollover the hanger, I created a movie, the doors open and an airplane flies out of the hangar. I have several little movies throughout the interactive such as this. I created the hangar animation as a seperate swf file. In my main movie I created a button, on rollover it loads the hangar swf into an empty movieclip. When I publish and view the swf it plays slow and choppy. First, is it possible to write actionscript to load the external swf ,but it stops on the first frame of the animation and when you rollover it continues to play.To put it all in a nutshell, I want to create several buttons throughout the movie with loadmovie functions, once the swf movies are loaded I want them to stop on the first frame of the animation and when you rollover loaded swf movie I want it to continue to play the animation. Should actionscript be applied to the swf movies first and preloaded into the main movie. And what will make the movies run smoothly once it's published and viewed in a browser.Also if this makes a difference, I created the animations in after effects, exported them as FLVs imported them into flash and exported them as swf. Again it runs really slow and choppy

View 1 Replies

Previewing Externally Loaded Images?

Jul 30, 2009

I was wondering if there was a way in Flash to preview externally loaded images in Flash while still working.I am loading images externally to keep the file size down on a piece of elearning but now I'm afraid maintenance will be a nightmare since you don't actually see the screens until you publish. I have interactions on the screens so I need to see them for their placement on screen.

View 5 Replies

ActionScript 3.0 :: Externally Loaded SWF Files?

Aug 3, 2010

I have the action script that loads external SWFs on a button click, but I don't know how to make it so that the slides switch after a few seconds on their own as well as on a button click. I know it has to do with a timer - but I have no idea how to do that (i'm super new to AS) Can someone please either tell me what code I need there or direct me to atutorialHere's the code I'm using so far:

var Xpos:Number = 0;var Ypos:Number = 0;var swf:MovieClip;var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest("swfs/one_btn.swf");

[code]......

View 12 Replies

Access Main Swf X,Y From Externally Loaded It?

Jan 7, 2010

I have a site that I'm working on that I am loading an external swf page into a main one. The main one is based on a totally liquid state and stretches the background to fill the browser and the components are relatively position based on browser window dimensions.

Now inside of the main swf I load an external swf through the loader command. This swf has a set dimension and stays centered in the stage.

I am trying to make a button in this swf that loads yet another swf that is stretches the full browser. However I do not know how to access the properties of a main swf from this external one, or if this is even possible.

View 3 Replies

Actionscript 3 :: Getting Information From An Externally Loaded SWF?

Mar 30, 2011

So I have an SWF that I've made and I need to appened some instructions to the beginning of the project. I figured the easiest way to do this was to make the animation in a separate SWF then import it to the start of the first one. My problem is that I can't find a reliable way to tell when the first SWF is finished playing. I've googled the heck out of this but I can't seem to find anything that works. For some bizarre reason, no matter what I do the program seems to think that the external SWF only has 2 frames, if I put an ENTER_FRAME listener and trace externalSWF.currentFrame I get "1, 1, 2, 2, 2, 2, 2, 2..." My code looks something like this.

[Code]...

Also, for the record, the external SWF plays properly when I add it as a child. The problem is removing it from the stage when it's done playing. It's interactive so I can't just do a frame count.Edit: So I tried doing a getQualifiedClassName() call on extSwf and I got "Instructions_fla::MainTimeline_Preloader_" which could explain the frame discrepency. How can I have access to the actual timeline?

View 2 Replies

ActionScript 3.0 :: Put At The End Of The Externally Loaded Movie?

Jan 14, 2009

on frame one of the main timeline I am loading an external movie. When that movie gets finishes playing, I want to jump back to the main timeline, to frame 2.

What actionscript do I put at the end of the externally loaded movie?

stop();

this.parent gotoAndPlay(2); ?????

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved