ActionScript 3.0 :: Resize Listener Where Change Movieclips Dimensions And Positions
Dec 11, 2010
I've got a resize listener where I change my movieclips' dimensions and positions.[code]But how I set the minimum allowed resize of the stage?I don't want the stage to be smaller than 1024x600 for example.
I've got a large bitmap (1920 x1306) that my client wants as a bg image, scaled to the swf size on load (930 x 575); but that can "grow" up to its original size if/when a user expands the browser window. All the rest of clips in the display list are to remain in place (except for a copyright clip, which they want to always be 14 pix above the bottom of the browser frame. I've tried loading the bitmap dynamically at full size and then using scaleX,scaleY to set it's initial smaller (930x575) size, and I've tried just setting the height/width of the dynamically loaded image using the math of scaleX,ScaleY just in case the scaleX "transformed" the bitmap so that it couldn't return to its original size. Both make the bitmap the right size. But the resize function below did nothing to it, (or the copyright.y.) THEN I tried just putting the bitmap into the display list (both sizing methods work here, too). But even as an original member of the compiled display list, the resize event is still not reaching the target. Everything I've seen on the web says this should work - but...no luck.
I have a MC with an instance name MovieClip_1 and I create another like this:[code]So basically, what I want to know is how to nest MovieClips using code, display them, and change their positions reletive to their parent MovieClip, and not the root/stage.
How can I adjust flash so it values can only be whole numbers for dimensions and positions? For some reason flash likes to adjust the numbers I enter in the properties flash changes the number slightly. i.e i set the width to 500 and it'll adjust it to 500.05 or 499.05.
What do I have to write to keep the movieclip not to change dimensions if the user starts playing with the dimensions of his screen ? I remember it was a line of as3 written at the beginning.
I'm creating a website within which I would like to achieve a menu system at the bottom of the page with a white band behind similar to this site:
[URL]
I have created the menu buttons and band but I can't figure out how to maintain their relationship with the edges of the browser window if it is rezised at any point during a user's visit (same as the site above).
I have been setting the position of the buttons and all other elements using, for example :
IE 8 Flash CS4 v10 Windows XP Home SP3 (NOTE: The word "Resize" refers to an HTML change of the movie size; it does not refer to a Window resize)
Objective: Display a transparent 800x600 flash movie in IE, stretching movie to 100% width and height of webpage but keeping the objects within the movie from getting re-scaled. Objects are re-positioned at runtime via ActionScript with values meant to be relative to stage dimensions.
Problem: The movie resize is messing up the object re-positioning. The movie is indeed stretching to 100% of the width & height of the browser window's client area, but the objects are repositioned relative to something else (perhaps screen dimensions, but not sure). Result: Objects which were programatically positioned relative to original stage size are spaced way too far apart in IE, in some cases off the screen entirely, though they were not like this in the Flash editor.Question(s): Why are objects which were positioned within the original stage dimensions being kicked off the browser screen while the movie itself remains entirely on-screen even after resize? What dimensions/values are guiding the automatic post-resize repositioning of the objects? (These proportions appear to be different from the change in proportions of the movie itself.)
I'm using netstream in a video player that uses Flashvars to play flvs. The problem is that all the flvs are different dimensions. I'm not exactly sure how to handle this. (I know components stretch to fit, but I like using netstream.)
i have written an air app which is fixed in dimensions: 1000 w X 800 h i have set the resizable and maximizable tags of the app-xml to false, to prevent the user from changing it's size. this app looks and interacts perfectly at these dimensions but not at other: it has "bad" coding techniques in it like hard-coded display sizes and such, rtl and ltr combined layoutdirections and so forth...
when the applicationComplete event dispatches, i check Capabilities.screenResolutionY and if it is less then 800 i want to resize the app programatically (preserving the width/height ratio). i have tried all the StageScaleModes and tried changing the dimensions of the stage, the nativeWindow, the app itself("this") and so on in every combination.
i am looking for a way to resize the entire app as is, meaning i dont want to use display logic of the components and such, just to "shrink" or "expend" the whole app as is, with hard-coded pixel amounts to change within the logic of the app accordingly (change all sizes, locations, fonts etc.. in sync) the app should look and work exactly as it did in it's 1000x800 default size, only smaller or bigger
I've 6 different movieclips on stage, with one main focal movieclip in the center. What i need is that when clicking on the surrounding movieclips they animate in to swap their position with the main focal movieclip, which then animates to take it's replacements former position. So after a few mouse clicks all of the movieclips could have had their position shuffled from it's original location.
I know i've seen a similar thing on a photo gallery where the current photo is swapped with whatever thumbnail is clicked on but can't seem to find an example.
Currently i have the positions of the movieclips controlled by variables, the animation handled by tweener, and can quite happily find the position/scale etc of the movieclip that get's clicked on, but can't figure out how to get the focal movieclips details as it might never be the same movieclip.
I'm having an issue using randomizing the appearance of movie clips using Math.random. I have a movie clip in the library, which is 85 frames long but it begins and ends with 15 blank key frames. In other words, it has 2 layers, one for action script and one for graphics which are movie clips too, the AS layer is 85 frames long while the art layer is shorter and begins on frame 16.
I began by putting the movie clip on the stage, without any code on the main timeline, with some code on the movie clip's timeline - this.x = Math.random()*stage.stageWidth; this.y = Math.random()*stage.stageHeight;
In this case, tested the movie, the swf played just what I wanted, the movie clip "appears" randomely on the stage, plays, disappears, and reappears, and so on and so forth.
I then gave the movie clip on the stage an instance name of b_mc, removed the code in its timeline, and put it on the main timeline, as such - b_mc.x = Math.random()*stage.stageWidth; b_mc.y = Math.random()*stage.stageHeight;
In this case, the movie clip does NOT appear randomly on the stage when the swf is tested, rather, it appears at the same position, appearing and disappearing over and over as planned, but in the same place - NOT as planned.
well i'm working on a small scale game and I appear to be coming across some small issues that I was hoping someone could help me with. I have this:
ActionScript Code: if (_root.mc_player._x <= 540){ stop(); }else{ gotoAndStop(2); }
in the frames actions.What I am trying to achieve is that when the players x position is greater than or equal to 540 it changes frame, I've tried various adaptations of this such as the following:
mc_player is the instance name of the player (obviously :P) and when i enter the second code it just jumps straight to frame 2, so far it seems that the code is just setting the players x position at 540, so i tried setting it using actionscript like:
I have somme mc's on the stage an I want thatto change on mc with antoher by clicking on them. For example if I click on mc1 and than on mc2 than they schould change the positions.
iv been trying for awhile now to get a few of the buttons im using on a site to change dimensions when i hover
basically i would like the button background to change dimensions and extend length wise to the other end of the web page whenever the mouseover appears the lenght of the botton extends smoothly and also goes back to its original size smoothly without snapping back
iv read lots of tutorials (got adobe flash cs4 book) but its all about moving images and so forth not really dimensions
if anyone can point out a tutorial or knows how to resolve this
i'm using AS3 and I'm trying to change the stage dimensions to get bigger when I press a button. The current dimensions are 550 x 700, and I thought the code:import flash.events.MouseEvent;btn.addEventListener(Mouse Event.CLICK, makeStageBigger);function makeStageBigger(evt:MouseEvent) {stage.stageWidth = 800;stage.stageHeight = 900;}would work, but nothing happens. I'm getting no errors or anything, but when I click the button, it doesn't work.
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?
I have a Sprite object on the stage. What I should do in order to change the dimensions (viz.,size,colour, or both ,etc) of this Sprite object, when it gets clicked?My sample code looks like this:
Code: var circle:Sprite = new Sprite(); stage.addEventListener(MouseEvent.CLICK,onStage); function onStage(e:MouseEvent):void {
I've developed a game in the dimensions 1024x1280.I realize now what a massive mistake that was..My question is, is there any way to make the dimensions smaller dynamically or by using the IDE WITHOUT manually revamping everything (I'm not willing to do this )
I have a listener that calls a function which sets up everything on the stage exactly where and how I want it, works great. However..I also use the same function for my initial setup, and it's not triggered until/unless someone resizes the window, and as a result, everything is a mess until the window is resized.I could just duplicate the relevant bits in a separate function, but that seems needlessly redundant.Is there a way to trigger the function upon the initial load without waiting for a resize event?I would just call the function directly at the end of the script, but it expects a parameter that I can't figure out how to pass it.[code]
I got a very short question but I can't seem to find it on the internet (might be because I'm using the wrong terms). Is it possible to listen with a listener when a movieclip has been resized? I know there is a listener to do this with the Stage object. If this is not possible: do I have to make an interval that constantly checks if a movieclip is resized?
I'm currently working on a center stage component and I was wondering if there's a good way to detect when a stage component has been changed if any of the elements inside it have been enlarged?
This seems like it should be available but I can't find one that doesn't fire before the redraw. Or at all for that matter.
I am trying to set a listener so that I can respond to an flvComponent when it resizes etc. I am not uses any home made classes. I have stripped the code right down to this, and it still wont work! Have dragged a flvcomponent onto the stage and given it the instance name myVideo.
ActionScript Code: stop(); myVideo.addEventListener(AutoLayoutEvent.AUTO_LAYOUT, fred); function fred(e:AutoLayoutEvent){ trace ("hi from fred"); }
when I test I get "type was not found or is not a compile time constant:AutoLayoutEvent". I can do all sorts of processes like changing flv being played, moving it around etc.
how do I call the re-size action at the first frame? It works great once you resize, but isn't called at the beginning. I've tried a few things, but I'm shooting in the dark at this point.