ActionScript 3.0 :: Scaling A MovieClip After Loading Image Into It?
Apr 23, 2009
I have a doubt regarding scaling a movieclip. I tried this method where I make a movieclip dynamically, add an image to it which I load from my desktop. The image appears fine. But when I scale the movieclip using the mc.scaleX and mc.scaleY properties the mc woudnt budge. There must be some other wat we can accomplish that. Can someone put in some thoughts on it. here's the code..
[Code].....
In the code I have not used the scaling codes since it doesnt work. And when I add the two line code, the image disappears, but the mc is on the stage which is clickable. maybe I should place my mc inside a container?
View 2 Replies
Similar Posts:
Nov 19, 2010
i have read a number of tutorials on the internet trying to find a fix to the problem i am having. Everytime i create a new movieclip using public var mc:MovieClip = new MovieClip(); the movie clip is created after setting the values and drawing a square to show it in the file. However when i add an image to the movie clip i created it scales to be the same size as the movie clip or half the size of the movie clip which isnt what i want.
mc.addChild( GameTile ); // add the square instance into display list
GameTile.loadBitmap("stronghold.jpg", 0, 0);
This is the code i use to add an instance of my image class to the movieclip called mc. I was wondering if anyone has a simple way of scaling the image to its original size within the new movieclip instance? I have tried various ways of scaling and it works but when the window is resized the image is not the correct size.
View 4 Replies
Feb 9, 2009
In my movie I have a few products that I resize dynamically based on which one is selected. the selected product is shown full scale while the other are scaled back. However the scaled back ones lose image quality and look pixelated. the products are currently movieclips in my presentation. Is there a way to use scale w/o it distorting the image? I'm currently using TweenLite for my tweening/scaling.
View 1 Replies
Oct 7, 2009
I'm trying to tween a large image 6917x1500px. I'm moving the x,y and scaling this image. It's a jpeg, and the image really chuggs at certain sections. Has anyone tweened an object this large before? Should I be trying tween lite? I don't think that will work, because it just has less settings.
View 5 Replies
May 20, 2010
i have a diagonal movieclip that I am trying to scale along with the background video. The background video scales perfect, I am attaching the diagonal movieclip (br in the code as bottomright) with addChild
Instead of scaling with the window, it seems to repeat such as the image is displaying. this is the main section of the code that is doing the scaling
var br:mc_bottomright = new mc_bottomright();
addChild(br);
//proportional scale
if ((stage.stageWidth / stage.stageHeight)> (owidth/oheight))
[code]....
View 4 Replies
Apr 10, 2009
I am trying to achieve an effect of scaling a movie clip on click...very similar to [URL] When the user clicks on See, Hear, Play and Shop boxes, the boxes expand. I have created a box movieclip that has a bar on top. This bar is a movie clip inside the box movieclip. When i try to scale the main box movieclip, the internal bar movie clip scales as well. How to stop this?
View 2 Replies
Sep 28, 2009
I am using an xml list to hold some data+image for different items. for each item im trying to display the text/images in a movieclip.So im taking the url thats store in the xml file and creating a url loader to load the url. which works fine. but how do i then load that image into a movie clip.Heres the code:
var imgLoader:URLLoader = new URLLoader();
imgLoader.addEventListener(Event.COMPLETE, insertLogo);
// do a for loop to get the xml data for the right item.
[code]....
View 1 Replies
Apr 1, 2003
I want to load an image onto a Movie Clip when I press a button. So far, for the button on the stage I have:
[AS]
on (release) {
loadMovie("pics/1.gif", _root.photo);
}
[/AS]
I've created a movie clip on the stage w/ the instance name photo. My images are in the folder pics relative to the flash file. When I run the movie and click on the button, nothing happens.
View 6 Replies
Nov 27, 2009
I have an existing MovieClip called mc1 on the Stage. That MovieClip has 2 keyframes, the first one has an image in it, and the second one is an empty keyframe.After compiling, I want to load an image (image1) from the library into the the firstkeyframe, and replace the existing image.
I know I need to right click on the image in the library, export it, give it a class name, and I need to assign an url to it which would be 'image1' in this case.I was thinking of this, but I cannot get the url right, and I dont know how to refer to the firstkeyframe after I've loaded it...
var Imagecontainer:Loader = new Loader();
var image:URLRequest = new URLRequest('image1');
Imagecontainer.load(image);
mc1.addChild(Imagecontainer);
View 3 Replies
Nov 8, 2009
how would I LOAD an image.. into a movieclip.. then resize the movieclip to the size of the image..
now I know how to put the image inside of the movieclip with addChild(), but then when I try to resize the movieclip to the size of the IMAGE, it changes the size of the image inside the movieclip.. now I know that when a movieclip scales so does everything else.. so my question is.. how to go about modifying this to make it work no matter what
basically I have a editor so to speak and when you drag the blips it will resize it.. but the problem is actually LOADING the image into the movieclip because once it is same width/height as the movieclip (and shows that way on the screen) my script will handle it perfectly. is there a trick to this.. here is the code I've got so far..
Code:
function dispatch(e:Event):void {
this.removeChildAt(2);
var l:LoaderInfo = imageLoader.contentLoaderInfo;
[Code]....
the loader can change so I remove it from the movieclip when the dispatch function gets called, imageLoader is the loader which loads the image.. sizes just returns either max sized resized proportions or regular height of the image.. note "this" or rather the element I'm using is by default 100x100.
View 3 Replies
Nov 22, 2009
how to load photos from a XML file into flash. I have a movieclip (called PhotoMC) that has two layers, bottom layer is a square(is a graphic). Top layer is a blank MovieClip where I would like to place the image loaded from XML. I'm trying to have the movie clip(PhotoMC) load for each jpg in my xml. So basically a movieClip will be attached to the jpeg.
View 1 Replies
Oct 18, 2010
I am trying to load an external .swf (actually it is only an image that I published as a swf file, not a complicated movie) but I get errors. I am trying to load the .swf into a movieclip and the movieclip appears on the stage. I have put the code in frame 1 where the image should appear (in the movieclip). The code that I used is below and works fine with a .jpg and when I load it directly on the stage, that is to say, when I put the code in a frame on the stage. Why does it not 'work' right now?
I have added 'parent' in 'parent.event.target.content.y = 200;' in the first frame of the movieclip timeline, to make sure that it will appear on the (main)stage. The error that i get is this one:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at galerie2010_fla::mcBallon1_11/frame1()
This is the code in frame 1 in mcBallon1:
var imageRequest1a:URLRequest = new URLRequest("images/SWFoverig/ballon1_702x368.swf");
var imageLoader1a:Loader = new Loader();
imageLoader1a.load(imageRequest1a);
addChild(imageLoader1a);
imageLoader1a.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete1a);
function onComplete1a(event:Event):void{
parent.event.target.content.y = 200;
parent.event.target.content.x = 205;}
View 2 Replies
Dec 21, 2002
I have a textfile with:
1. Some text to be loaded into a textbox
2. an url of an image I want to load into a movieclip
Code:
loadVariables("mytextfile.txt", "_root");
urlpic = _root.urlintext;
loadMovie(urlpic, "_root.pic");
This doesn't work, and neither does: url1 = _root.url1.text;
View 12 Replies
Nov 6, 2006
I am trying to load an image into a movieclip and then draw the contents of the movieclip to a bitmapData object.
Below is some sample code.
target.jpg_mc.loadMovie(url);
target.createEmptyMovieClip("loader_mc", 100);
target.loader_mc.bmc = target.jpg_mc; // movieclip where to load original image
target.loader_mc.tmc = target.bmp_mc; // movieclip with smoothed image
target.loader_mc.onEnterFrame = function(){
[Code] .....
For some reason it always draws a white box rather than the image. Has anyone ever seen this happen with the bitmapData class?
View 4 Replies
Jul 12, 2007
using the following code i am trying to get a movieclip to reposition itself prior to loading an image. Then once the new image is loaded - the other movieclip will reposition itself. Currently, the functions are cancelling each other out - b/c the one function is within an onEnterFrame - take a look:
Code:
holderHitMC.onRelease = function() {
holderMask.newY = -854;
if (holderMask._y == -854) {
[Code]...
As you can see - i have a button with an onRelease command telling the movieclip to reposition - then onEnterFrame once the file is fully loaded the movieclip should return. The problem with this is that it does not allow the movieclip to move for the onRelease b/c the onEnterFrame is saying to go to the other position. If i add the delete this.onEnterFrame the movieclip - on future loads will reposition for the onRelease fuction but will not return.
View 6 Replies
Apr 1, 2008
I'm loading jpg to videoclip and it works on Flash IDE preview, but not in published .swf (IE)(It doesnt load images)How to make it work?I have tried adding
System.security.allowInsecureDomain("*");
System.security.allowDomain("*");
But no difference..*edit: I'm viewing the published swf in network drive, the images would be loaded from intranet http?
View 1 Replies
Mar 6, 2011
I'm converting Kirupa tutorial for AS2/XML gallery to a AS3 image gallery that works with AMFPHP.I'm running into a output error:TypeError: Error #1010 After some searching I found out that the script says that there's a undefined propperty in the script below. It should load an image from the Array "Image" in a empty movieclip wich excists on stage called "picture" ["picture"+0] is also used in other parts but then as ["picture"+p]. P=0 with an increment based on button clicks (previous and next)
function firstImage() {
if (this.loaded == this.filesize) {
picture.alpha = 0;
var loader:Loader = new Loader();
[code]....
View 1 Replies
Jul 26, 2009
I am having a killing problem in loading multiple images in single movie clip/sprite using a separate class. Here is the ImageLoader.as class
[Code].....
View 1 Replies
Oct 27, 2004
I am trying to load a random image into a movie clip that will scale 100%. Then have the content MC noScale and stay the same. If I insert a picture into the bg movieclip, it scales and shows up no problem. Soon as I try to load a random image into the bg movieClip the picture just does not show up!! But what is even weider, is that I have it set up that if the picture is 100% loaded for another MC to play, which it does! So the picture is there, but it's invisible? And no the picture is not progressive.
Code:
Stage.scaleMode = "noScale";
Stage.align = "LT";
bg.onResize = function() {
this._width = Stage.width;
this._height = Stage.height;
[Code] .....
View 1 Replies
Sep 15, 2010
I'm loading an external SWF file, which become a MovieClip, using Loader(). That part is working fine. I then need to scale the MovieClip to match the stage, so that when I set the width and height of the movie doing the loading in SWFobject, the MovieClip will scale too.
For example, the SWF being loaded may be 320x240, but we decide later that we want it to be 640x480 on the page. We can just change the width and height in the javascript call to SWFobject, and it should scale everything. To top it off, I'll need an AS2 version too because we might need to load AS2 SWFs.
[Code]...
View 3 Replies
Nov 15, 2010
I have made a webpage that scales to the size of the users screen. Now i'm having to following problem. There is a image gallery in this website that makes use of an XML file. Everytime when the website is scaled to a bigger size the image gets unsharp. This only happens to the external image that is displayed in the gallery since the flash elements are all vectors.I was already thinking about a higher DPI rate or using different images.
View 2 Replies
Jun 3, 2007
I'm having problems scaling images in Flash with ActionScript 3.0. The only way I can see to get the quality decent is by using smoothing, which drastically hurts performance.
The thing that confuses me is that I made the same site in ActionScript 2.0, targeting Flash player 7, and the image quality is fine when scaling even without smoothing. As soon as I target Flash player 8 (or 9 with Actionscript 3.0) the quality degrades when scaling.
I don't have to move back to Actionscript 2?
View 4 Replies
Oct 13, 2009
I'm currently having a problem regarding scaling an image to fit on a frame. Well I tried searching this forum, found some results, tried it but not working with me.So here's the situation, I have a frame with a size of 260x300(width/height). What I want is to scale all images(jpg) automatically to that size when loaded.By the way, I'm currently making my own flash playlist and the image I'm talking about is the album art.
View 1 Replies
Aug 23, 2010
I'm writing a movie that should load image from external location and display it in placeholder. I called placeholder "imageMC" and I gave it dimensions on 250x250 px.Next I load image using Loader class and I'm waiting for complete event.After that I try to resize image so it will fit to placeholder. I also want to keep fine aspect ratio.My code looks that:
ActionScript Code:
function onComplete(e:Event):void {
var wFactor:Number, hFactor:Number, originalWidth:Number, originalHeigth:Number, newWidth:Number, newHeigth:Number;
originalWidth = loader.content.width;
[code]....
The problem is line: "imageMC.addChild(bmp);". When I add a bmp as child of imageMC the trace statement looks like:
Quote:
250:187 //loader.content dimensions
252.05:362.4 //imageMC dimensions ??!! WHY THEY ARE CHANGED???
250:187 //bitmap dimentsion
and imageMC resizes his heigth and display image wrong scaled.But when I add bmp as child of stage: "addChild(bmp);" trace looks like:
Quote:
250:187
250:250
250:187
and image is scaled propertly.What is cause of this error?
View 2 Replies
Apr 11, 2005
I need to scale an image so that it won't distort. Of course I don't know the dimensions of this image.I tryed something like this but it doesn't seem to work at all.
Code:
loadMovie("../ImageUploadFolder/optimized_images/" + this.file, "_root.back_mc.image_panel_6.imgContainer6");
[code].....
View 14 Replies
Feb 21, 2006
i am trying to load the image in MC and i want to scale the image proposinate from the center.
View 2 Replies
Apr 24, 2003
can scale a group of images with different sizes into one fixed size?
In other words, I have an array of images coming into my movie. that have different sizes. I place each image upon a Mc that resides inside another movie clip and resize accordling. The problem is, all of the images have to be the same size. I want to be able to import any size image and scale and resize it to a specific size.
View 6 Replies
Jan 17, 2010
I thought this was going to be easy, and hopefully for someone it is, but I'm having a tough time so thought I'd ask here...
I have an image - say 50 x 30 - 1500 pixels.
I need to scale it so that it keeps it proportion, and takes n pixels - say 20 for example.
View 5 Replies
Mar 10, 2010
I load pngs to my flash project. The media size in the project is 1000x635. When I scale my project bigger than the that size I loose quality. the project is used on many different screens therefore scaling is needed.
Is there a way to keep image quality when scaling?
View 1 Replies
Jul 17, 2010
i placed a fullscreen background image in my website but when i scale my browser window it also scales unproportionaly (or distorted).
Code:
Stage.scaleMode = "noScale"
Stage.align = "TL";
bgTest._width = Stage.width
bgTest._height = Stage.height
[code]....
View 6 Replies