ActionScript 3.0 :: Calculate Positions And Scales?
Sep 16, 2011
For some reason the "scaled.width" - the movieclip that have scaled already - after scaling it even more with TweenLite.to function by factor .3 aren't equal with the predicted result => scaled.width * .3. Orginal width is something I don't know but scaled width is something like 420. Now multiplying it by factor .3 the result should be something like 140, now when I put TweenLite.to function to scale my scaled movieclip by factor .3 the width in the end is something like 267.And frankly speakin I really can't imagine where the result came from.
Some back ground:I import three images dynamically. Each of them to their own MovieClip containers. I don't know the dimensions of images so I need to scale them proportionally to their dimensions to fit to the desired size.That was intuitively easy. I managed also to align them horizontally in the center of the screen after the first scaling by the knowledge that their registration point can be found from the top left corner. I also managed to align each of them on vertically in the middle of the 1/3 part of the empty stage with desired marginals: in the top there are 20 pixels space, between the images there are 20 pixels space and in the bottom there are 20 pixels space.
Now the problems comes when I need to tween them to their final positions. Each of them to the top of the stage and each of them in 1/3 part of the empty space horizontally scaled at the same time smaller with factor .3.Intuitively when I think the x position can be found by same way than the way I found y positions (related to the space left after the middle image is positioned). So in theory I thought the x position for the image that comes in the center should be as much as finalX = stage.stageWidth / 2 - current.width * .3 / 2(the center point of the stage minus the half of the width of the image after the scale)but when I give finalX for the tweenLite as a x position and .3 as a scaling factor the result is something different.
View 1 Replies
Similar Posts:
Sep 29, 2005
I'm just wondering if hitTest can be affected by the changing x,y coordinates or the changing scale of the parent clips. My platform engine doesn't seem to work everytime I try to add a script to a parenting clip (of a playable character and a computer character) that changes the x and y values of that clip as well as the scale (simulating a camera that keeps both characters in focus).
View 2 Replies
May 4, 2011
How can I calculate the next position of a "enemy" if know the positions x, y, rotation and speed?
View 1 Replies
Jan 22, 2007
I have thumbs placed on the stage. I create an empty mc to load swf. But my thumbs disappear from the stage when I test the movie ( html or swf) if I settle the _ and _y position of the empty mc.why the emptymovieclip positions affect the positions of my thumbnails?
View 2 Replies
Jul 1, 2011
I as this working in AS2 and need to update to AS3...shows that AS3 doesn't like sloppy coding. Here's what I need: I pull data from an XML and that works when I put the data into a dynamic text box. However, I can't seem to get the date of birth into a variable. I have some code that calcs age in years but uses a string literal that I thought I could just replace with a variable from my XML...ain't a workin'. Here's the code I have:
ActionScript Code:
import flash.display.*;
import flash.text.*;
import flash.events.*;
[Code]......
View 0 Replies
Dec 6, 2010
I won't pretend like I'm really at all familiar with Flash. I'm making a project where I'll have several movie clips on the scene. When you click each movie clip, I want it to scale larger. I got the code working and it does do that. Trouble is, now when I click any one of the clips, it scales all of the clips at the same time.
This probably has to do with the fact that I'm using the exact same code for each script and only changing out the MC name. What do I need to add to the code to make it so each MC is working individually from one another?
[Code].....
View 2 Replies
Nov 18, 2006
Is it possible when I click on a thumbnail that the thumbnail scales to 100% of the picture (in an motion scale?), centered in the movie, and when I click again on the large picture that the picture re-scales to the thumbnail back again.
View 4 Replies
Oct 15, 2010
when i put my swf in an html page and view it using FF 3.6.10, it gets bigger and looks ugly (all the photos pixelate). noScale is set and the swf doesn't otherwise scale (e.g. if i minimise the window or press F11), which is the correct behaviour. Problem does not occur in IE8.From reading about similar problems i thought the best embed method was a combination of object tags. I've tried:
Code:
<object
type="application/x-shockwave-flash"
[code].....
View 1 Replies
May 13, 2010
I'm using this code:
Code:
Stage.align = "BC";
Stage.scaleMode = "noScale";
var $stage:Object = new Object();[code].........
To make everything align to the bottom of the .swf when it scales, as most of my MC's won't need to scale. The bottom part stays pretty much on it, imagine a desk, with lots of stuff on it, then as you resize, the background extends, which is why it aligns bottom.There is then a bar at the top and a bar at the bottom. the bottom bar is fine, it is naturally aligned to the bottom, so it doesn't need to be told to do anything.The top bar is giving me some grief though. I've tried all sorts of code to try and make it sit up the top, but it just doesn't want to.
View 14 Replies
Oct 20, 2010
I'm using the following code in an attempt to decrement the X and Y scale of an image the problem is scaleX and ScaleY uses a number between 0 and 1 to do its business. I can't seem to get a number to decrement below zero.
PHP Code:
var b:Bitmap = new Bitmap(c);
var counter0:Number;
var counter1:Number;
for (var i=0;i<100;i++){
if(b.width >204){
counter0-0.1;
[Code] .....
View 2 Replies
Mar 1, 2010
I loaded an anim.swf to the main.swf the anim.swf has some animation. in the main swf i have codes that changes the x and y coordinates of objects placed in the stage by there width/height. but the problem now is, since the anim.swf has some animation, it is screwing up the x and y coordinates since, it appears that the anim.swf is changing size (width and height) due to the animation.... Is there a ac3 code or some other settings, that can turn that off, so i have just the actual size of that swf and maintaining it?
View 3 Replies
Mar 23, 2011
i want to know whether the website www.hbo.com is scaling or not and can you give a brief hint how to get same type of resizing effect . Because i found the the website have fixed minimum hight and minimum width and i scales to fit the browser window when it resizes.
View 1 Replies
Mar 26, 2012
im trying to set up a simple form where you can type a pin and submit it to switch to another movieclip. Im using Flash CS5 and ActionScript 3. I have some MovieClips which get resized on a RESIZE Event. The movieclips get perfectly resized to the stages size so they fill it out. The problem i have is the scaling. To avoid scaling everything i used the following two lines.
[CODE]...
View 1 Replies
Jul 5, 2010
I have a container on the stage in which a swf is to be loaded when you click a button. This works fine when the content of the .swf being loaded into the container does not have content floating outside of its stage, this is a problem for me because the .swf being loaded in has content that exceeds the width of its stage, but is masked. The masked content on that page will be made visible when the user mouses over the masks. So its essential that the .swf being loaded in exceed the dimensions of its stage.
Initially, when I click a button that is a child to the menu_mc, the swf loads into the container correctly, but when I MOUSE_OUT of the menu_mc the content within the swf scales to reflect any content that exceeds the width of its stage. I'm not sure if this is the result of the way I am the loaded swf. The swf is designed to scale up and down when the user MOUSE_OUT or MOUSE_OVER of the menu. The menu is designed to be hidden when not in use.Here's my code:
ActionScript Code:
import caurina.transitions.*;
import caurina.transitions.properties.DisplayShortcuts;[code].....
Additionally, I ran into a problem when I moused over the buttons that are children to the menu_mc. Whenever I rolled over them the content in the menu would hide itself off stage. So I came up with a solution that may not have been the appropriate course of action, but worked. In the MOUSE_OVER function of the buttons, I provided y coordinates for the other movie clips to prevent them from moving off stage. For the sake of better coding practices, would there have been a much more appropriate coarse of action.
View 0 Replies
Dec 14, 2010
Does anyone know how to resize all content on the site scales relative to the browser size of the viewer. Whether it is on a Netbook or a 30 inch screen all contents to fit on? I'm not talking about the basic center resize of stage.with and stage.heigh.
Basically I'm loading a content.swf in a main.swf and from the Main.swf, I want to be able to apply the resize all content method.
View 3 Replies
May 19, 2007
im trying to set up a simple form where you can type a pin and submit it to switch to another movieclip. Im using Flash CS5 and ActionScript 3. I have some MovieClips which get resized on a RESIZE Event. The movieclips get perfectly resized to the stages size so they fill it out.
View 3 Replies
Feb 15, 2005
i have a problem with flash mx 2004! I have 2 scenes.At first scene i have one button1 into in one movie clip1 and at second scene i have only one movie clip!!!Now, i want when i press the button (at first scene) i can to change the scales of movie clip2 (at second scene)! My code is this and i can go to scene 2 but i don't change the _scales!
on(press){
_root.gotoAndStop("Scene 2",1);
_root.mc2._xscale=200;
_root.mc2._yscale=200;}
View 6 Replies
Mar 29, 2010
I have a website which im designing exclusively in flash. The project size is 1000x500. The video which im using is 320x150. On the stage ive set the player to 320x150. The stage size is 1000x500 (thats the size and span of the website). When the page works from the internet. It expands to fill the screen of the viewing computer. Which is what i want anyway since Ive set my publish settings to get this. But the video player gets scaled along with the page that scales to occupy the viewing screen. So when the player becomes a little larger than its orginal size the video looks low quality. Is there a way that the player alone could be set to maintain its orginal size of 320x150 and not scale because this is causing the video to get distorted and pixellated ?
View 1 Replies
Oct 20, 2009
I have a project where I need to scale a graphic to the exact size as the window at all times. Is thereI have never done anything like this one before.
View 1 Replies
Oct 18, 2010
I have a symbol of a shape with a gradient drawn in Illustrator that I copied-and-pasted into Flash CS5. I created a simple motion tween by making the symbol move around the stage and scale. How do I now change the color of the symbol as it is moving on stage?
View 4 Replies
Feb 5, 2010
I was looking at making a site similar to this [URL]..The way the white frame scales into whatever the screen res is with no distortion and the center movie I have code to allow that to stay centered, but not sure how you restrict it from overlaying the frame thats on top of that.
Basically I was just seeing if anyone was able to replicate this exact movie, with out the graphics, and I can build the rest. If you need code that I have sourced already that is fine. I can send some of that.
View 1 Replies
May 28, 2010
How to make my mc scales every time i enter that frame on which mc is?
View 2 Replies
Oct 13, 2010
i would like to show my flash movie in a browser window so that it fills width and height as good as possible without distorting the movie. when i use the width and height attribute to the object/embed tags it only scales the width but not the height.
[Code]...
View 3 Replies
Jul 13, 2010
I am just learning actionscript 3.0 and am hoping someone can help me with a little problem. My code seems correct but only works half the time when I preview it. All I am trying to do is when a button is pressed, the content movie moves down to the right and scales down to 50%. The code works perfectly for the first few times I push the buttons but then starts to move some of the way and stop and I have to press the button at least one more time to get it to complete! Sorry this is so long winded but I don't know how to phrase it!
View 4 Replies
Jan 20, 2010
I have an FLVPlayback component instance on my stage, into which I load videos based on button presses. When I create a .swf of my project though, if I use
fscommand("fullscreen", "true");
fscommand("allowscale", "false");
I get unexpected behavior. What should happen is the file loads, everything is centered, and the area around the project is whatever the background color is.This sort of works .. until the first FLV is played. The FLV gets scaled to 100% (fullscreen)and if I hit "esc" I go back to the "normal" sized player, but if I then maximize the window (almost the same as fullscreen), the entire flash player now decides to scale, not just the FLV playback component
I'd like to be able to have my windows projector file to take up the entire screen when it's loaded (without being scaled), but this doesn't seem possible. Any ideas what's going on? Regarding the FLVPlayback component, I've tried everything to make it fit and not scale ....set height, width, set scale to "noScale", set registrationHeight, registrationWidth, etc. Nothing works.
View 2 Replies
Jan 28, 2010
[Code]....
I've been trying to add a resize function to this so that it can be viewed in different size browsers. Exactly like the opening page of this site [URL] So the whole page is always in view and scales until it reaches a set maximum size.
View 2 Replies
Nov 23, 2010
I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -
mx:Canvas
view:MyImage
mx:Bitmap
[code].....
View 1 Replies
Jan 29, 2012
Im using a dock gallery fx from flash xml components. But for some reason when I preview in browser the dock gallery scales out of the swf area. This doesnt happen if i change the p[ublish setting to match movie. But if the publish setting is set to perscentage gallery scales.
View 3 Replies
Oct 9, 2009
I have a movieclip in the library that I am exporting for actionscript. I duplicate the movieclip by adding a child for each occurance of a tag in actionscript. This works fine, but I can't figure out how to change the y postion of each new child to be 30 pixels below form the last child. Here is a snippet of the code where I am having the problem:
for (var i in xmlData.region){ for (var k in xmlData.region[i].regionInfo.payment);
var mcRI:regionInfo = new regionInfo(); this.addChild(mcRI); mcRI.txtPayment.htmlText = xmlData.region[i].regionInfo.payment[k].card; mcRI.y += 30; }
}
Instead of each new child's y position changing +30, every duplicate is on top of each other at +30.
View 3 Replies
Aug 11, 2009
What I'm really looking to be able to do, is have a clip in the root move to the same x and y as a clip that is embedded into another movieclip. How would I pick up the X and Y co-ordinates of this embedded movie clip?
To summarise,
ClipA is embedded into ClipB, what I want, is for ClipC - that is based in the root - to match ClipA's position.
View 2 Replies