ActionScript 2.0 :: Resizing A MC According To The Loaded Asset?
Jun 9, 2008
I have tried many things but when i load my external jpg inside a MC (thru the use of a MovieCliploader which then load the jpg inside that MC in an empty MC). I have put my code in the onLoadInit() and did something like
MC._width = target._width;
My MC has a specified width and height in the library. is it because of that or should i put it smaller.
View 1 Replies
Similar Posts:
Apr 1, 2009
I have a class called Bike.as, linked to a movieClip in the library. The class essentially tweens a bike graphic across the stage. At the end of the tween, I instantiate a new class called Slideshow. Slideshow loads an image. The image loads(I get no loading error, and I can trace info about the loaded content)... I just can't seem to see it. In attempting to debug, I wrote the loading code(in Slideshow) into the Bike.as file(replaced the code that instantiates Slideshow), and it worked. Did it work because Bike is linked to a movieclip, and Slideshow is not(Slideshow is called in Bike.as)? I'm attempting to transition from AS2 to AS3. Here's my Slideshow class:
public class Slideshow extends Sprite {
private var container:Sprite;
private var loader:Loader;
[code].....
View 1 Replies
Jan 21, 2010
I have an externally loaded swf that contains thumbnail movieclips. When a thumbnail is clicked an external image is loaded. I would like to be able to reposition this external image. I know I can use typecasting to control a movieclip of the swf but how do I control nested externally loaded files? I have a different approach that should work fine but I was just curious about my initial attempt.
View 0 Replies
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
Jul 1, 2009
What i'm doing is, getting the URL of the image I want from and XML file. It works just fine. It shows up on stage and everything. The thing is though, when I want to resize the image and everything, nothing shows up at all.[code]Basically me just adding imageLoader.with = 100; and imageLoader.height = 100; to the xmlLoadedF function.
View 2 Replies
Jul 27, 2011
I prepared a galley for my client that should load an external image, re-size it and appear while it fades in smoothly from alpha 0 to 100 (motion tween).
The thing is that it looks like the re-size interferes with the fade in action (motion tween from alpha 0 to 100) and as a result, it stuck in the middle of the fade in action. If I load it directly to a single key frame (without any motion) it works properly.
I have attached the code I am using below and attached the FLA so you can see it in your own eyes (change the fla.txt to fla.fla so you can open it with you flash app)
ActionScript Code:
//
//set stage for FBF
var loader2:MovieClipLoader = new MovieClipLoader();
[code]...
View 0 Replies
Feb 16, 2009
I have a problem on resizing dynamically loaded swf in to a flash movie. The senario is
1) swf files are uploaded by users and the path of the swfs(flash banners) are taken in to the flash via flasvars.
2)so swf uploaded for each user is displayed in a loop
The problem is user may upload swf with different sizes.So I want to re size them to main movie size(ie 500*70) So what i tried to do is using MovieClipLoader and fix the size in onLoadInit function.But it gives really different sizes
than expected.
I cant understand why flash behave like this.
1)Can i resize the extaernal swf by using above method?or
2)what is the approach to re size dynamically loaded swf s?
View 2 Replies
Jan 24, 2009
I was wondering, after looking into loading external images via xml- how you would control the size of those images on resize and on first loading.
Do you define the size of the container mc?
Can you apply the same or similar onresize code as you would when applying it too images on the stage?
View 4 Replies
Oct 17, 2011
I just need to know how to resize and reposition my jpg image that I loaded in with this code...
import flash.net.URLRequest;
import flash.display.Loader;
var myFileRequest:URLRequest = new URLRequest("image.JPG");
[Code]....
Right now it is sitting in it's default spot of the upper left hand corner.
View 4 Replies
Jun 8, 2006
Im having a problem. Im trying to load external swf's into an MC using reateEmptyMovieClip(), but what i cant do is resize the swf in the new MC.I need it to fit whatever size the MC is (50% smaller in this case).
View 4 Replies
Aug 16, 2007
Ok, so i'm working on this project here [URL]
I modified how it looks, but generally speaking, it's the same thing.
the files are located here; [URL]
I may have renamed something or another, but basically I'm trying to tell it to scale the loader if the picture is beyond a certain height. This is the code I added.
trace(picture._height)
if (picture._height >= 800){
picture._x = 180;
[Code]....
it's returning a trace of 0, I think it's because it's tracing it before the picture gets loaded.
I read someone else's case about how you'd have to replace how it's loading, in order to fix it.
i'm using Actionscript 2.0, in flash pro 8. It's publishing for flash player 7, and actionscript 2.0
View 3 Replies
Jun 16, 2009
I am uploading different size of images dynamically but at the same time I want the stage to be resized accordingly to image's height and width.
View 11 Replies
Dec 28, 2005
I've got a client who's asking about resizing dynamically loaded images in flash. basically i'm building him a button that displays dyn. text and loads a .png based on a variable (easy). I'm going to tell him that actionscript/flash really has no means of resizing a loaded image and that you need some type of server-side script to do all of that.
View 2 Replies
Apr 9, 2009
Im building a site for a photographer, all images are xml driven.. When a thumb is clicked the full size image is loaded into an empty movie clip.
I am after a similar effect as seen here..[URL] If you resize the window the image resizes to scale...
I have managed to align the rest of the movieCLips to the stage when it is resized in its right positions just can't get the image to resize!.
View 3 Replies
Jun 10, 2009
I wonder if any of you can point me in the right direction. In my stage I have a movieclip where I want to load several images with different sizes. This mc called "container" adds the loader to the stage so I'm asking for the loader width and height once has finished loading and then passing these to the width and height of the mc container so it resizes accordingly. But...it doesn't work. Here is my code:
[CODE]
var pic:Loader;var totalImages:int = 10;for (var i:uint = 0; i<totalImages; i++){ pic = new Loader() container.addChild(pic) pic.load(new
[code].....
View 3 Replies
Feb 1, 2012
I loaded a swf from external. using loader class. But if i check with the width and height of the loader is differes from loader.contentLoaderInfo.width.
loader.width // 1250;
loader.height // 750;
loader.contentLoaderInfo.width // 750;
loader.contentLoaderInfo.height //420;
From this statement i came to know the loader gets the width of all hidden objects, which are already outside of the stage area. But now I need to increase the size of the stage contents only..
View 0 Replies
Mar 22, 2010
i'm new to action script 2.0 and i want to create a movie clip dynamically whose position and dimensions are changed in each frame as loaded from xml;
[Code]...
the position and dimension are changed but the problem is the last dimensions are not removed and it get bigger n bigger
View 1 Replies
Nov 1, 2010
I am not simply trying to contain things and have the container resize without the contents resizing. I would just use a simple MovieClip for that.. My main focus is on the use of BitmapFill. I'm trying to make a repeating background image for a container; thus far I'm able to draw my BitmapFill sprite to the size I want. (Which is the stage's height) but when the stage is resized, I want to re-size my container but have my containers BitmapFill crop or add more as the window is resized bigger or smaller. Allow me to illustrate what I mean:
I've got a simple rectangle sprite that fills with a bitmap from the library and a simple resize handler function that detects when the window has been resized.what I would like to do is have my rectangle resize to the height of the stage.stageHeight maintaining its bitmap fill, but not resizing the bitmap fill or any children within the sprite.
From what I've read, this is a little tricky because the sprite resizes in relation to what it contains.. or.. something like that.. I really don't know any more.. I saw one example where a person extended the sprite class but I don't know why or how..
in my library there is an image called 'pattern' and my code looks like this:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);
[code]....
View 2 Replies
Sep 11, 2009
I'm loading a few pngs/jpgs externally so they can be swapped out occasionally, and the issue I'm running into is when they are shrunk they become fairly choppy. Is there a way to have flash re-render them, or do something to smooth the resizing as opposed to going in and resizing every file manually myself?
View 1 Replies
Nov 2, 2010
I've got a little problem with BitmapFill, I'm trying to use a sprite as a container for various things and i would like it to have a filled pattern background. my problem is that i want it to resize the sprite to the height of the window but not have the background fill resize, and add more / crop as the window size is changed. to illustrate what i mean, please view the diagram attached to this post .
I have an image in my library called 'pattern' and my code is as follows:
ActionScript Code:
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
[Code].....
View 2 Replies
Jan 8, 2011
I'm changing scalex of an object over time.
Code:
function onLoop(){
angle+=1;
obj.scalex=Math.cos(angle*3.14/180);
}
The object becomes thiner and thiner. Is there any way how to know where(x,y) is the top left corner of the object?
View 2 Replies
Apr 10, 2010
I know just loading the movie and then using getBytesLoaded will check to see if it is actually loading, but I'd rather run of test of say, 10 assets to see which are present and then start loading them after I know which ones are there.
View 2 Replies
Mar 1, 2010
What is the class of an embedded asset?
[Embed(source="picture.png")] public static const picture:Class;
what is the class of:
new picture();
what superclasses does it inherit? i thought it would be Sprite, but it gave me a TypeError.
View 1 Replies
May 23, 2011
I am trying to load assets from an SWC into a SWF at compile time, in as3. I'm getting the information about which assets to load from a JSON file. I can do so statically, but when I try to define the names dynamically, I'm running into problems. So for example I can do this:onemech[+ tmpObj.id] = new mech3 as MovieClip;And it loads the asset named mech3. But what I would like to be able to do is something like
var mechtype:String = "mech" + mechtypenumber;
onemech[+ tmpObj.id] = new mechtype as MovieClip;
Obviously, that doesn't work.I looked around a bit and I found this here, which seems to be angling toward what I need, but I can't figure out how to apply what's said there to my specific situation.
View 1 Replies
May 22, 2009
As I am building a Flex framework for minigames, I plan to bundle a bunch of graphic assets (movieclip symbols) into a single swf file, which I will load into my Flex application, before extracting the symbols from the swf file for use in my application
View 3 Replies
Aug 19, 2010
When I was building apps in as2 - my main method of project distribution was to create a bunch of different swfs, each representing, probably, a timeline, some code, and a set of graphical assets. Tho cumbersome, it meant that I could progressively load large chunks of the project as needed, at runtime.
Obviously - working in as3 - this changes a bit. My last project ended up being a bit too large, even when all assets had been optimized - mostly because I just embedded them in one swf and loaded it (kinda long load time). So - new project, wondering what solid methods are available for loading packages of external assets. I could, obviously, just load everything individually, but I would like class linkage and symbols already defined - rather than doing this manually for bitmaps.
[Code]...
View 4 Replies
Jun 28, 2011
I am trying to implement a card game using Flash Professional CS5. Since flex makes the final size bigger, I do not want to use Flex for now. I have some difficulties to bind code logic with assets. I have a Deck class and Card Class and 52 card images which are converted to movie clips.
Option 1: I can create linkage to those movie clips means that I will have 52 different classes for each card and I have to create 52 different classes to put my functionality for each card.However I do not want to create 52 classes so is there any other solution?
Option 2: I found embedding asset paths to classes in Flex like that;
Code:
[Embed(source="xxx")]
public var customClass:Class;
So is there a way to make it without using flex in action script code?
View 3 Replies
Oct 25, 2009
So I've seen many a tutorial on how to do this in AS3 but I'm trying to work out if there is a way to have all my assets for a game I'm making external, so they can be shared with a level editor that resides in a different .swf and won't be loaded twice.I spent a while looking and found out about Shared Libraries, which at first I thought would solve the problem, until you find out that you can't use attachMovie to attach anything to the stage at run-time if it is an imported object, which just sucks to be frank .So I then thought of a work-around for that by adding these shared objects inside a MovieClip that wasn't shared so I could add that from the stage and access the clip inside using the instance name that I would assign it. This worked fine until I remembered that I had was using several Bitmaps and the BitmapData class, hence if I placed these bitmaps in a MovieClip I can't even assign an instance name to access them to perform the code that I wish to on them.
View 2 Replies
Dec 15, 2009
If I draw something manually, can I still change the colour by actionscript? I want to draw a cat, and the cat colour depends on the the user choice in the previous 'screen'. How should I go about this?
View 7 Replies
Aug 2, 2010
I have a Symbol in Library with linkage name: box_mc
import flash.display.MovieClip;
import flash.events.Event;
import Src.smoothAnimate;
[Code]...
but when run is make error:
1151: A conflict exists with definition box_is in namespace internal.
i want when flash run, the box_is will be add in stage, resize by function changesize.
View 1 Replies