Scaling of a MovieClip in AS 3.0 after the loading image in there?
Hello
I have a doubt regarding the scaling a movieclip. I tried this method where I do a clip dynamically, add an image I load my desktop. The image appears in good condition. But when I scale the movieclip by using the properties mc.scaleX and mc.scaleY the mc woudnt move.
There must be a few other wat, we can achieve this. If someone can put in a few thoughts about this. Here's the code...
//Load the image here var url:String = "a.jpg"; var urlRequest:URLRequest = new URLRequest(url); var loader:Loader = new Loader(); loader.load(urlRequest); //addChild(loader); //Create the movieclip here and add the image to it. var mc:MovieClip = new MovieClip(); mc.buttonMode = true; mc.addEventListener(MouseEvent.CLICK, clickHandler); addChild(mc); mc.addChild(loader); mc.x = 120; mc.y = 50; function clickHandler(event:MouseEvent):void { trace("You sunk my battleship!"); }
In the code I haven't used scaling codes because it does not work. And when I add the code of two lines, the image disappears, but the mc is on the scene that is clickable. Maybe I should place my mc inside a container?
Regards and thanks in advance.
Roshan Kolar
For the code you show, using a different image, I added:
mc.scaleX =. 5;
mc.scaleY =. 5;
After the reinstallation code and it works fine.
How did did you encode it?
Tags: Adobe Animate
Similar Questions
-
I'll have a terrible time with the 3.0 AS and animating CC 2015.2 in this project. I was given a suggestion, but now I'm so confused output errors that I hope to get answers from you advanced people.
The project is similar to this:
Identify the Structure of the trees
Framework 1 - nothing selected, visible instructions
Frame 2 - Select sheets by clicking on the image (tree top or bottom) or text, leaves description becomes visible
Frame 3 - branches select by clicking on the image (tree top or bottom) or text, description branches becomes visible
Frame 4 - trunk select by clicking on the image (tree top or bottom) or text, description of trunk becomes visible
Suggestion is:Do the video clip of each region of image tree and drop it on the layer smaller on top with alpha 0%
Create a badge of the clip, and then tap on timeline with each framework has put in evidence and description
Make the text button, then tap chronology framework with each has put in evidence and description
Trunk frame – more small area place top layer
Branches Frame - smaller than the leaves but superior to the place of the trunk between the two
Framework of leaves - most square of the area on the layer under the Branches
Can anyone offer any suggestions? I used to program 5.5 Flash with Actionscript 2.0, but difficulties with Animate and Actionscript 3.0. I don't know if I have to use swaps or specific images, but when viewing, he travels all frames without stopping even if each image as the AS command stop ();
Thanks in advance!
RickYes, if your buttons or movieclips, overlap one on top Gets the default click event. So, if you decide to create separate movieClips or separate buttons, be sure to give everyone an exclusive space.
One approach I've used in the past for such things is to open the work, the tree in Photoshop then "cut" art into segments and put each segment in a different layer in Photoshop. Then you can import that art directly in to animate and each layer will import under a separate post. Then you can combine them into a movieClip to a work of art on the stage. From there, you can select each segment and each a movieClip or button you want.
-
load image link in movieclip problem
Hello
turns out the problem is resolved, be rejected to test the animation but it works on the actual swf.
second problem 'load link image movieclip problem. "
I have this code, what it does is ask the text input from the user to the "input text" field, there must be a link to an image from somewhere, and then it will load that link (image) in a movieclip on the stage.
button1.onPress = function() { < < button1}
var inputText.text = linkText; < < inputText is the input text field
trace (linktext);
loadImage (linktext);
}
function loadImage (imageName) {}
avatarContainer.avatarHeadOuter.avatarHead.loadMovie (imageName); < < avatarContainer is an mc on stage
overlayContainer.overlayHeadOuter.overlayHead.loadMovie (imageName); < < overlayContainer is an another mc on stage
overlayContainer.overlayHeadOuter._alpha = 15;
stats. Text = imageName; }
When I run the test Movie (ctrl - enter), loadMovie works.
When I run on real html after publication, loadMovie does NOTHING. He said something like Flash Player has stopped a security operation.
My wild guess is file html problem? can I do to ignore that secure bs
problem solved, it turns out that some pictures and some, probably a server does something to protect their images hosted.
-
I want to be able to load external images into different frames in a movieclip and then to control inside the code. To do this, I need to know how to create a movieclip empty with a quantity of images can I specify in the code and how to put different pictures on different periods of the movieclip. How can I do this?
When you create a movieclip in actionscript, it contains an image and there is no way to change/increase.
You can create a movieclip with several images in the authoring environment and do what you want, but I don't know that makes a lot of sense.
-
Adding movieclip "loading" in the dynamic image gallery?
Hello again,
I finished my Gallery of images based on the XML, but the direct test after I realized I did a rookie mistake and not to put some kind of placeholder "loading" loop movie clip while the thumbnails - and the images at full size - are responsible. Images will appear randomly when loading and I would like to be able to insert a placeholder clip while they load and exchange with the thumbnails/images after that that it was loaded. The placeholder clip is in my library (loadingLoop), but I have problems to make it work properly.
Here is the original function that transforms the XML and adds thumbnails; It's when I try to insert the clip of space reserved by XML child node (each attempt I did just keep throwing more errors, so I failed in my attempts to avoid confusion), and I joined the XML file for testing. And a preview or help would be appreciated.
Browse to the external XML file and trigger the xmlLoaded when finished
xmlLoader.load (new URLRequest("data/artGallery.xml"));
xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);Load the XML file and process the location of images
function xmlLoaded(event:Event):void {}
XML = XML (event.target.data);
analyze the nodes in the XML file
xmlList = xml.children ();
count the number of nodes in the XML via XMLList
trace (xmlList.length ());
loop to load all of the vignettes, based on the number of nodes in the XMLList
"I am" = all of the child nodes in the XML file
for (var i: int = 0; i < xmlList.length (); i ++) {}Add loadingLoop movie clip by node and wait for thumbnail to load before swapping with thumbnails imageLoader <-help!
for each node, create a new instance to put on stage
imageLoader = new Loader();
load each thumbnail from its location by the 'thumb' of the XML node attribute
imageLoader.load (new URLRequest (xmlList [i] .attribute ("thumb")));
position of the miniature instances per XML node (horizontally on stage)
imageLoader.x = i * 110 + 10; thumbs has so 100 x 100, + 10 for width, plus + 10 of left border
imageLoader.y = 10;
for each node in the XML list, the instance name with the path to the location of the image full size
imageLoader.name = xmlList [i] .attribute ("source");
for each node in the XML list, add a drop shadow
imageLoader.filters = [thumbDShadow];
Add thumbnails to stage
addChild (imageLoader);
dropTween = new Tween (imageLoader, "y", Bounce.easeOut,-100, 10, 1, true);
implemented vignettes to wait click Run showPicture
imageLoader.addEventListener (MouseEvent.CLICK, showPicture);
set thumbnails to scale up when spilled
imageLoader.addEventListener (MouseEvent.ROLL_OVER, sizeUP);
}
}my mistake. use:
function xmlLoaded(event:Event):void {}
XML = XML (event.target.data);
xmlList = xml.children ();
for (var i: int = 0; i< xmllist.length();="" i++)="">var mc:MovieClip = new MovieClip();
MC. Ivar = i;
addChild (mc);
MC. LDR = new Loader();
MC. LDR. Load (new URLRequest (xmlList [i] .attribute ("thumb")));
MC. LDR. Name = xmlList [i] .attribute ("source");MC.x = i * 110 + 10; thumbs has so 100 x 100, + 10 for width, plus + 10 of left border
mc.addChild (mc.ldr);
MC.loadingloop = new loadingLoop();
mc.addChild (mc.loadingloop);
MC.filters = [thumbDShadow];
mc.ldr.contentLoaderInfo.addEventListener (Event.COMPLETE, removeLoop);mc.addEventListener (MouseEvent.CLICK, showPicture);
mc.addEventListener (MouseEvent.ROLL_OVER, sizeUP);
}
function removeLoop(event:Event):void {}
event.target.loader.parent.removeChild (MovieClip (event.target.loader.parent) .loadingloop);
}
} -
Please help on the Loader.content movieclip
Hello
I've been search autour and got the mixed solutions, summarized as follows:
If I need to load external swf into the main swf file, I need charger with URLRequest appropriate for this purpose.
Once charged, you can listen to the event complete and addChild the loader.content to the main swf.
Because I have a stop on the first frame of the swf loaded, I need to run the SWF with a button. Solutions on the net pointed out that it happened, you must mount the loader.content to MovieClip and have to thanks to a delicate way to do it as
var movie: * = loader.content;
var clip: MovieClip = film;
clip.gotoAndPlay (4);
.....
I tried this method and I still don't have a Type constraint: cannot convert flash.display in MovieClip
Please help, do not know why some experts said that it works while I can't function. Thanks in advanceHmm, you try to load an AV1 (Actionscript 1, 2) SWF? If so, you are having some problems. AS3 does not handle these well. You better downgrade your app to AS2 and using MovieClipLoader. Import an AS3 SWF should enter native mode without any necessary data conversion
evt.target.content.gotoAndPlay (2);
WL
-
Hi guys,.
I'm new here! I was wondering if someone could explain to me what I'm doing wrong here.
As part of a mapping system of the Flash-based campus, I am creating an area of 'Information on the rooms' which displays some information about the rooms around the campus, according to the data stored in a Microsoft Access database.
The .asp file that I use works fine, and my dynamic text boxes display correctly the information that each record in the database is queried.
However, I also try to post a picture of the room. The image files are located in the same directory as the .swf, they are not progressive .jpgs. I tried to use the following code (which works for everything except images):
onClipEvent (data)
{
Create a Clip to load images in
mcRoomDatabase.createEmptyMovieClip ("MyImagesHolder", 0);
strName = name;
strBuilding = construction;
strType = Type;
strProjector = projector;
strSeats = seats;
strRoamNet = RoamNet;
strPosition = "Record" Add String (CurrentRecord + 1) add 'to' String (TotalRecords);
loadMovie (name + '.jpg', mcRoomDatabase.MyImagesHolder);
}
-----------
Nothing will load in the movieclip. If I use the code (for an imaginary room called Room100)
loadMovie ("Room100.jpg", mcRoomDatabase.MyImagesHolder);
the picture perfectly. If I put a new dynamic text box to display
Name & ".jpg".
It shows Room100.jpg, which is the same as what I walked when I try directly above.
I'm confused as to where I'm wrong? Sorry for the long post!
Thanks a lot for reading
AlexWe know not if you load external movie, then in the
film external loading a jpg. If you you have a synchronization problem in that the
scenario is not increasing and can run before the swf is completely
load.You are better off with MovieClipLoader if you need to know when the swf file is
load so you can perform methods on the loaded swf file.Or you can insert the code to load the image into each external swf file.
Other points:
1.
onClipEvent (data)
{
According to me, fires whenever bytes arrive, which could be several times
We if you are in test mode or live.
2.
Add the operator is deprecated. Use + instead.http://livedocs.Macromedia.com/Flash/8/main/00002924.html
3. If you create a critical application mission your code reveals that you need
update your skills AS you use old techniques.--
LON Hosford
www.lonhosford.com
Number of happy bits exempts your way!
"Alex UK"wrote in message
News:e1uj2d$RM4$1@forums. Macromedia.com...
Hi guys,.I'm new here! I was wondering if someone could explain to me what I am doing wrong
here.As part of the Flash-based campus mapping system, I am trying to create a
"Room
Information "box which displays some information about the rooms
around
the campus, according to the data stored in a Microsoft Access database.I use the .asp file works properly and my dynamic text boxes
are
correctly display the information in each record of the database is queried.However, I also try to post a picture of the room. Image files
are
located in the same directory as the .swf, they are not progressive .jpgs. I have
have tried to use the following code (which works for all, but)
the
images):onClipEvent (data)
{
Create a Clip to load images in
mcRoomDatabase.createEmptyMovieClip ("MyImagesHolder", 0);strName = name;
strBuilding = construction;
strType = Type;
strProjector = projector;
strSeats = seats;
strRoamNet = RoamNet;
strPosition = "Record" Add String (CurrentRecord + 1) add "from".
String (TotalRecords);loadMovie (name + '.jpg', mcRoomDatabase.MyImagesHolder);
}
-----------
Nothing will load in the movieclip. If I use the code (for an imaginary
room called Room100)loadMovie ("Room100.jpg", mcRoomDatabase.MyImagesHolder);
the picture perfectly. If I put a new dynamic text box to display
Name & ".jpg".
It shows Room100.jpg, which is the same as what I walked when I try
He
directly above.I'm confused as to where I'm wrong? Sorry for the long post!
Thanks a lot for reading
Alex
-
Living corners disappear after the scaling of form
The Live corners feature is welcome in Illustrator 17.1, but I find it works irregularly. A question that I've isolated is this scaling a path done living corners disappear.
To reproduce:
Create a rounded rectangle
Select the path
Click the direct Selection tool to check that the corners to live
Click the Selection tool
Rounded rectangle (say slide upward from the point of the scale in the middle of the underside) scale
Click the direct Selection tool - where are the living?
Is this a bug? What is a design choice?
You to scale proportionally?
The rounded rectangle still isn't a form of living. But the live function recognizes corners a rounded corners. But when you resize the object (especially do so fairy) you could resize it so that the corners are not recognized any more.
-
hitTestPoint() shapeFlag does not not on movieClip containing the loaded swf
I have a file .swf that contains a circle jpg I load from a URL, make a movieClip and add it to the stage.
I would like to be able to detect when the user places the cursor over the circle. I wish it were accurate in a way he doesn't simply use the framework encompassing the circle, but the real circle himself in order to detect a collision. It is a fragment of my current code:
var myCircle:MyCircle = new MyCircle (swf);
myCircle.addEventListener (MouseEvent.MOUSE_MOVE, onMouseMove);
myContainer.addChild (myCircle);
private void onMouseMove(event:MouseEvent):void {}
var glowFilter:GlowFilter = new GlowFilter();
glowFilter.color = 0xffffff;
If (event.currentTarget MyCircle) {}
var object: MyCircle = event.currentTarget as MyCircle;
If (object.hitTestPoint (event.stageX, event.stageY, true))
event.currentTarget.filters = [glowFilter];
else event.currentTarget.filters = [];
}
}
I was led to believe the shapeFlag hitTestPoint() method parameter wouldn't do this, but assigning true or false doesn't make any difference. Any ideas why this could be?
convert your png to a vector (select your png on stage, and then click Modify > bitmap > trace bitmap) and remove the background.
-
MovieClip is hidden, but still shows the same width
Hello
I have a moveclip with 300 x 900 content inside, I've hidden this content in this movieclip with mask form 300 x 250, infect I've hidden the content in this movieclip but it shows always 900px in height is not the amount of rest but showing the height that I'm unable to align the content dynamically. Is there any solution for this... ?
Your images do not show a problem. Hidden content displayed in the blue box of your second image would be correct. Only what is behind the small hidden area will appear, but that does not affect the size of the movieclip being masked. The movieclip will remain the size that it is.
-
Load images from XML to specific movieclip
I'm still a beginner. I load the images into specific movieclip because they load on all the other layers. What should I do?
I made a simple slideshow tutorial.
I guess it would be better that I show all code parts are not specific:
Import fl.transitions.Tween;
Fl.transitions.easing import. *;
Import fl.transitions.TweenEvent;
var my_speed:Number;
var my_total:Number;
var my_images:XMLList;
var my_loaders_array:Array = [];
var my_labels_array:Array = [];
var my_success_counter:Number = 0;
var my_playback_counter:Number = 0;
var my_slideshow:Sprite = new Sprite();
var my_image_slides:Sprite = new Sprite();
var my_label_slides:Sprite = new Sprite();
var my_preloader:TextField;
var my_timer:Timer;
var my_prev_tween:Tween;
var my_tweens_array:Array = [];
var my_xml_loader:URLLoader = new URLLoader();
my_xml_loader. Load (new URLRequest ("sshow.xml"));
my_xml_loader.addEventListener (Event.COMPLETE, processXML);
function processXML(e:Event):void {}
var my_xml:XML = new XML (e.target.data);
my_speed=my_xml.@speed;
my_images my_xml =. IMAGE;
my_total = My_Images.length ();
loadImages();
my_xml_loader. RemoveEventListener (Event.COMPLETE, processXML);
my_xml_loader = null;
}
function loadimages (): void {}
for (var i: Number = 0; i < my_total; i ++) {}
var my_url:String=my_images[i].@URL;
var my_loader:Loader = new Loader();
my_loader. Load (new URLRequest (my_url));
my_loader.contentLoaderInfo.addEventListener (Event.COMPLETE, onComplete);
my_loaders_array.push (my_loader);
}
my_preloader = new TextField();
my_preloader. Text = "Loading";
my_preloader. AutoSize = TextFieldAutoSize.Center;
my_preloader.x = (stage.stageWidth - my_preloader.width) / 2;
my_preloader.y = (stage.stageHeight - my_preloader.height) / 2;
addChild (my_preloader);
}
function onComplete(e:Event):void {}
my_success_counter ++;
If (my_success_counter == my_total) {}
startShow();
}
var my_loaderInfo:LoaderInfo = LoaderInfo (e.target);
my_loaderInfo.removeEventListener (Event.COMPLETE, onComplete);
}
function startShow (): void {}
removeChild (my_preloader);
my_preloader = null;
addChild (my_slideshow);
my_slideshow. AddChild (my_image_slides);
nextImage();
mon_timer = new Timer(my_speed*1000);
my_timer.addEventListener (TimerEvent.TIMER, timerListener);
my_timer. Start();
}
function nextImage (): void {}
var my_image:Loader = Loader (my_loaders_array [my_playback_counter]);
my_image_slides. AddChild (my_image);
my_image.x = (stage.stageWidth - my_image.width) / 2;
my_image.y = (stage.stageHeight - my_image.height - 20) / 2;
my_tweens_array [0] = new Tween(my_image,"alpha",Strong.easeOut,0,1,2,true);
}
function timerListener(e:TimerEvent):void {}
hidePrev();
my_playback_counter ++;
If (my_playback_counter == my_total) {}
my_playback_counter = 0;
}
nextImage();
}
function hidePrev (): void {}
var my_image:Loader=Loader(my_image_slides.getChildAt(0));
my_prev_tween = new Tween(my_image,"alpha",Strong.easeOut,1,0,2,true);
my_prev_tween.addEventListener (TweenEvent.MOTION_FINISH, onFadeOut);
}
function onFadeOut(e:TweenEvent):void {}
my_image_slides.removeChildAt (0);
}
Did you give a name to the symbol instance that you dragged to the scene? His name should be "my_slideshow".
NDS, please also remove addChild (my_slideshow);
-
make the button instance that contains the specific image of movieclip playback
What I want to do is have a movieclip that has many executives and become a button and make different instances of the button and have these instances display a certain slice of the underlying movieclip. I am very new to AS3 and was a very beginner with AS2 and have no idea what to do here yet. I searched some tutorials and found nothing helps me so if someone knows something or can help I would appreciate it.
Btn1.addEventListener (Event.ENTER_FRAME, gotoFrame);
function gotoFrame(event:Event):void {}
Btn1.stop ("Blue");
}
It makes no sense at all. It you just have to:
Btn1.gotoAndStop("Blue");
--
Kenneth Kawamoto
-
Tween current position after the previous tween movieclip
I hope someone can give me a hand with a little script I'm trying to drag a movieclip on the stage. The clip is five times the width of the stage and I am using the Tween class to move on the stage when a key is pressed. The interaction I want, it's that when the button is pressed the clip moves to a certain amount. If the key again it moves further. The script I came up with good that resuming the movieclip in the original position of the movieclip and then moving, as opposed to the displacement of the position, he has reached after clicked on the first button.
I've tried a few things but nothing works. The script I use now is:
var myTween:Tween = new Tween (clouds1_mc, "x", Strong.easeOut, x-400, 5, true);
myTween.stop ();
I hope someone can help.
What your button code looks like - it was just myTween.start ()?-that would be a reason for him to do the same thing again and again. Your button must include all of the Tween code so that a Tween is again created with new starting points and end every time.
-
This feature looks like a long shot, but is it not possible to allow that a specific control resize while others remained the same at maximization or change the size of the window?
I have a sign (actually a tab in the tab easy) that has tables, buttons, text boxes and a chart. Ideally when lets say a user enlarges the window, and I would all of my conrols in the upper left corner to stay at their relative location, for example, controls stay that far from the top and left side, controls on the right side, stay xx pixels on the right side. And then having my graph resize to be bigger to fill that extra space.
This would allow all the controls do not to the funky look when the screen is resized. I know it can be done in VB easily enough but it seems that ICB allows only an absolute based position on the left and up.
Hello-
The splitter control should be able to supply what you need here. See the example for "Docking".
NickB
National Instruments
-
Why isn't my subject stay aligned to the pixel grid after the scaling?
All my points are lined up on the grid, but when I step up proportionately they leave the grid. I snap to Pixel and Snap To Pixel Grid both checked.
blackmath,
You can see more here,
https://helpx.Adobe.com/Illustrator/using/drawing-pixel-aligned-paths-Web.html
This paragraph is very relevant,
Objects that are aligned to pixels, but have not the segments of vertical lines or horizontal, are not changed to match the pixel grid. For example, because a rotated rectangle doesn't have a straight vertical or horizontal segments, it is not pushed to produce crisp paths, when aligned with the pixels property is set for her.
Maybe you are looking for
-
a few empty playlists on the phone?
Hi, since I turned on the music to apple, itunes game and library icloud - some playlists on my computer do not appear on my iphone. All the smart playlists are empty and a few non-smart ones. All I have this problem or found a solution? Most of t
-
Hello the keyboard of my laptop no longer works correctly. I can use some keys and delete and space do not work. This is after I installed the driver again. Before that, it was as if I am pressing a button and get two or more different letters. What
-
Get the current name of the Run Script
Hello I'm looking for the name of the current script that runs in DIadem. So I would like to call a script, and then everything is running I would record the name of the script (file name on disk) a text box on a report that I am generating. I know h
-
HP Mini: How to turn off a Mini HP laptop in case he hangs up?
My HP Mini laptop hooked up a couple of times. In this case, I have no choice but to disconnect the power cable so that the laptop will stop automatically when the power has dried up. I understand that this is not the right approach. Could someone
-
Help - Audio Service is NOT running - Windows Vista
Hello I checked several websites & forums solution to my problem before asking the question here. A week Audio feedback from my computer started to give me problems. At first the audio suddenly stops during normal operation & would not return unless