Resizing And Moving Dynamically
I'm looking to resize and move a movie clip with Actionscript and Easing. Here's an example of kind of what I'm looking for...
http://www.jamesgood.f2s.com/main.php
I'd really like to do it using Flash 5, is it possible?
Cheers, Mike
KirupaForum > Flash > ActionScript 1.0/2.0
Posted on: 10-27-2004, 11:46 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Resizing And Moving Dynamically
I'm looking to resize and move a movie clip with Actionscript and Easing. Here's an example of kind of what I'm looking for...
http://www.jamesgood.f2s.com/main.php
I'd really like to do it using Flash 5, is it possible?
Cheers,
Mike
Moving The Stage After Resizing - Or Moving All Objects On The Stage? Heeeelp
Hello! I'm in dire need of help!
I've been forced to resize the stage of my movie but as the stage is expanded to the right and down everything ends up in the wrong place. So I wonder:
Is there any way to move the stage rather than the contents thereon?
or
is there a way to move all the content on all layers and even all scenes simultaneously?
or
is there a way to expand the stage equeally on all sides rather than just right and down?
THANKS ALOT TO WHOEVER COULD HELP ME!
Freddy D, Stockholm, Sweden
Resizing/moving
Just for clarification, I'm a self-taught flash noob, and I've only learned what I've had to get by....
I imported a 40-frame gif into a flash movie i'm making... it pulled it in as 40 bitmaps, into 40 frames. This plays fine... but the gif isn't in the right location, and it's a little large.
When I go to move it, it seems to want me to resize and move it in each individual frame... which just can't be right! How could they expect me to eyeball each fo these changes in each frame?
I imagine there is a better way, but after wandering the toolbars and options for an hour, I'm giving in and asking for help... does anyone know the best way to do this?
Thanks!
-gerrygerry
"I'm doin' a one-nighter for bitin' Ed the mail man... the guy was tryin' to cast a spell on me... like a wizard or something."
"Are you sure about that?"
"I dunno... maybe he was just wavin' ..."
Resizing And Moving Across All Frames
Im really new to flash. I know there must be some faster way than doing this frame by frame.
I used swift3D to make some 3D animations. Then Imported them to Flash MX 2004. When I did this is places the 3D animations in the top left corner. What I want todo is make the animation a bit bigger and center it. Ive tried everything I can think of with no luck. I could do it frame by frame but there are 700 frames. Please help this flash newbie!
Moving And Resizing Entire Movie?
I don't think this is possible but i just wanted to make sure.
Say u've created a website or game, and it consists of lots of complex tweens, movie clips, buttons ... etc.
Now say u want to increase the size of ur stage. It will resize from the top left hand corner leaving ur animation off centre.
Now if u select everything on ur stage and move it so that it is central again, it will only move the first keyframe of each object, and not the entire movie. Leaving u with a dodgey animation were the symbols return back to their original position.
So the only way to do it, is to fustratingly go through every single key frame and move the object accordingly to its right position.
Is there any way that u can select the whole sequence of tweens and move every single aspect of the movie around the stage?
Any suggestions would be great
Thanx
Help With Resizing/moving Images On Rollover
Not quite sure how to address this problem. I am designing a simple interface, in which I would like to have button/logos that get bigger when you rollover them. This is fine and I have done this with a simple button, with a rollover image.
However i have arranged the 4 buttons i have in a horizontal row and would like it so the 3 unchoosen buttons get recessed or 'pushed' out of the way.
I have attached a small fla. mock up, if this is unclear.
If anyone can point me in the right direction - even what this function might be called then I would be very grateful.
[F8] Help Needed With Moving And Resizing With Actioncript
Heya I have made an example fla so I can get my head arround how to do my next project. Could someone please help me with the actionscript. All the details are explained in the fla but basicly:
I want the button "gotored" (contained within "scene" to move the movie clip "scene"
From X:-823.9 Y:174.9 to x:58 y:32
and to change the size
From W:1200 H:600 to W:1340 H:670
If you have time could you please leave comments in the script if not I will look it all up
Thanks
Moving Borders With Resizing Of Picture?help?
Hello, My first post here. Great site by the way. Ok, I am trying to get an affect of borders that resize with a picture everytime its loaded...Here is a link as an example of what I am talking about(notice as you pick the diffrent pictures in the gallery the border around the picture resizes to fit the current picture displayed!)Link:http://www.bludomainhosting.com/photography22/index2.php
How is this done..?
Thanks :D
Moving Or Resizing The Background Of A Scene
Is there a way to shift or move the background of a scene without moving the contents of it? So for example, let’s say I have an animated ball bouncing in the center of the screen, and I realize that I want to add something else to the animation (another ball perhaps) but I don’t have enough room to do this. If I just grab the ball and move it the animation will get messed up because the key frames are already set in place. In order for it to work right I’d have to grab every key frame and move them one at a time, which is basically like doing the animation all over again (especially if you have a complex animation with multiple layers and key frames). Resizing the background doesn’t always help either because by default flash always adds the new portions to right (if you add width) and the bottom (if you add height).
If there’s not a way to move the background, is there a way to specify which direction flash will add the new pixels to when resizing the document?
Any help will be appreciated. I can’t tell you how many times I've run into this problem.
Resizing Movies Dynamically
How can I resize my flash movies when the browser window resizes? Is this even something that ActionScript can do?
Dynamically Resizing Image
I need to dynamically resize an image via actionscript and am alittle new to actionscript so could use alittle guidance.
here's what I have:
// url value flashquerystring.cfm?imgHeight=300&imgWidth=300
// actionscript for image resize
imgFormat = new ImageFormat();
imgFormat.height = _root.imgHeight;
imgFormat.width = _root.imgWidth;
imgbox.setImageFormat(imgFormat);
// I may be way off as to how I set my imgBox variable. I made my image a movie clip and set that as the instance. I've attached the fla if that's easiest
thanks in advance
Resizing Fonts Dynamically
Hi -
we're trying to pull in some names from a database into flash that are then displayed in a panel.
Our probem is that the names will invariably be too long for the panel width, and so will need to wrap or resize to fit.
Is there a way that this can be done within flash?
if anybody could give me a few hints as to what route we should take - then I can pass this onto the coders
many thanks
Hot To Attach An MC To A Dynamically Resizing MC?
Hi there....
Hope you are all doing well. I have come across a small problem.
Here's a bit of background info.
I have an MC(clipMC) which i am resizing using ActionScript. The moveclip only resizes
horizontally. What i would like to do is attach a movieclip(menuClip) that contains my menu buttons to the right edge of the dynamicly resizing movieclip.
When the buttons are clicked the MC resizes and new content is loaded in.
Heres my code so far.
On resizing ClipMC. This is actually inside another MC as I am using it to mask an image.
Code:
onClipEvent (load) {
this._width = 700;
this._height = 500;
}
onClipEvent (enterFrame) {
this._width += (_root.changeWidth-this._width)/7;
this._height += (_root.changeHeight-this._height)/7;
}
on last key frame of flash. Just changes the width of the clipMC
Code:
stop();
_root.menuClip.button1.onRelease = function() {
_root.changeWidth=185;
_root.changeHeight=500;
};
_root.menuClip.button2.onRelease = function() {
_root.changeWidth=285;
_root.changeHeight=500;
};
_root.menuClip.button3.onRelease = function() {
_root.changeWidth=500;
_root.changeHeight=500;
};
_root.menuClip.button4.onRelease = function() {
_root.changeWidth=350;
_root.changeHeight=500;
};
What would i need to add to the menuClip MC to get it to "dock" to the right edge of my resizing MC.
I tried putting this on the menuClip MC:
Code:
onClipEvent (enterFrame) {
this._x -= (_root.changeWidth-_root.clip._width)/7;
}
but it doesnt really give me the desired result. The menu over shoots the clipMC
Any help would be much appreciated.
thanks in advance.
Robert
Resizing Images Dynamically?
I want to resize an image dynamically,
I know that this._yscale and this._xscale resize the image in percentage way.
And that this._y and this._x place the picture according to co ordinates.
and this._width and this._height resizes it according to pixels. So i should use this one to resize it. However when i try to resize it, it doesnt show up at all on the screen??????? but when i dont use this._width and this._height it does....
Any Ideas
Dynamically Resizing Text Box
I'm trying to create a textbox that has a fixed width, but the height changes depending on how much text there is. I can't quite seem to figure out how to determine when the text overflows the current textbox size.
Dynamically Resizing Mask
Is it possible to dynamically resize a mask I created programmatically? I tried, but it doesnt work. Here's what I've done:
this.createEmptyMovieClip("maskMC", 100);
maskMC.beginFill(0x000000);
maskMC.lineTo(0, 0);
maskMC.lineTo(900, 0);
maskMC.lineTo(900, 560);
maskMC.lineTo(0, 560);
maskMC.endFill();
outerMC.setMask(maskMC);
Stage.scaleMode = "noScale";
Stage.align = "TL";
var myListener:Object = new Object();
myListener.onResize = function() {
var stageH:Number = Stage.height;
var stageW:Number = Stage.width;
if (stageH>=560) {
maskMC._y = stageH;
} else if (stageW>=900) {
maskMC._x = stageW;
}
};
Stage.addListener(myListener);
When I test movie, the mask works. But the second I try to resize the stage, the mask doesnt work anymore and nothing shows up.
Resizing Boxes Dynamically...
Ok, first off I just want to thank you all for taking time with my other posts to help me out, I really appreciate it!
Now my question.
So I have a dynamic menu system, where text is getting loaded from SQL to a text box (dynamic). However sometimes there are so much text that it will go past the preset size. So I would like to find out how to resize it dynamically by height.
Now when you move your mouse over the menu selection, I would like a rounded box to lightly highlight the menu selection, however if I have a resizing text box, how can I script a rounded box to be the size of that particular menu selection? I guessing I might have to have the text box in a MC, and find a script to resize the rounded box to meet the height, width and position of the Movieclip.
Any ideas to research this or coding examples would be GREATLY appreciated.
Dynamically Resizing An Image
Hi all.
I have an image that I am trying to resize depending on the size of the window. The thing is, when it resizes it looks pixelated and horrible. I have no idea why this is. The image is a gif that is 321 x 347 and it pixelates when shrinking down as well as up...
my code looks something like this and yes, my image is a bunny:
var bunnyHmax:Number;
var bunnyWmax:Number;
var thisbunnyW:Number;
var thisbunnyH:Number;
var bunnyratio:Number;
bunnyHmax = bunny_mc._height;
bunnyWmax = bunny_mc._width;
thisbunnyH = bunny_mc._height;
thisbunnyW = bunny_mc._width;
bunnyratio = thisbunnyH/thisbunnyW;
if (bunnyHmax < 200) {
bunny_mc._height = Stage.height * .4;
bunny_mc._width = Math.round(bunny_mc._height/bunnyratio);
}else{
bunny_mc._height = 347;
bunny_mc._width = 321;
}
Resizing A Dynamically Loaded SWF
Hi, I'm trying to load in a movie using 'loadMovie' into an empty movie clip. The movie being loaded is a linear playing .swf movie I made using Sorenson Squeeze. I've got a 320x240 video and I want to resize it to 240x180 and play in my flash presentation. Whenever I try to change the movie container's width/height the movie disappears. I can hear the audo but no video. Here's an example of what I've tried:
Code:
movieToOpen = video_txt.text;
_root.createEmptyMovieClip("movieHolder_mc", 100);
movieHolder_mc.loadMovie(movieToOpen);
movieHolder_mc._width = 240;
movieHolder_mc._height = 180;
I've also tried using a .onData event to do resizing there. What am I doing wrong? Or can you just not resize a swf like this? Any help is appreciated, thanks
Resizing A Dynamically Loaded SWF
Hi, I'm trying to load in a movie using 'loadMovie' into an empty movie clip. The movie being loaded is a linear playing .swf movie I made using Sorenson Squeeze. I've got a 320x240 video and I want to resize it to 240x180 and play in my flash presentation. Whenever I try to change the movie container's width/height the movie disappears. I can hear the audo but no video. Here's an example of what I've tried:
Code:
movieToOpen = video_txt.text;
_root.createEmptyMovieClip("movieHolder_mc", 100);
movieHolder_mc.loadMovie(movieToOpen);
movieHolder_mc._width = 240;
movieHolder_mc._height = 180;
I've also tried using a .onData event to do resizing there. What am I doing wrong? Or can you just not resize a swf like this? Any help is appreciated, thanks
Dynamically Resizing Text Box Width
Hello,
I'm working on a movie that imports a list of peoples names via XML, and then horizontally scrolls the names on the movie (similar to a stock ticker).
I have everything working, but I'd like to make it a bit cleaner by fixing up the spacing between the names as they scroll by. Currently, I have a MC instance that I dyanamically create via ActionScript for each name. Every MC instance is 200 pixels wide with a 150 pixel space between each MC instance. This would be fine if everyone's name were the same length, but they are obviously not.
What I would like to do is to minimize the width of each instance depending on the length of the name so that the spacing between each MC instance is approximately the same.
Does anyone know a way to do this that doesn't involve a fixed-width font?
Thanks in advance,
-mike
Dynamically Loaded Picture - Resizing
I am working on a picture viewer that will step through all pictures in folder. The pictures are all different sizes.
How would i go about resizing the dynamically loaded picture to fit inside a specified area in the movie? Below is the update function used to load the picture.
Thanks
function update() {
url = filename+picnum+".jpg";
loadMovie(url, picture);
}
Dynamically Resizing A Text Field
Ello all
I have a tool tip movie clip that is just a dynamic textfield hovering about and was wondering if anyone knows if its possible to resize the textfield to fit the amount of text it contains
thanks in advance
Dynamically Resizing Bar On Button Click.
Hi guys. I have five buttons. Everytime i click on a button, a bar underneath must resize to accomodate information. On a click of a button, the movie goes to a specific frame where info is located. How would I go about achieving the bar resize?? I'm an actionscript newb. thx for help in advance!
Dynamically Resizing A Dynamic Textbox..
Hi. Just making a news page for my site, the contents of the news is loaded from a database. thats all easy. problem is, i want the dynamic text box (that displays the news) to change size to fit the news. i.e. at the moment, if there is a very long news item, then it just makes the text too big for the box and you have to scroll down to se it. i know this kinda sounds like a strange request but it makes sense if you could see what im doing.... i need it so that the textbox resizes itself to grow big enough to fit in all the text. any ideas?
thanks in advance
Rich
Resizing Main Stage Dynamically
I've seen this before and haven't found it by searching. The main stage or movie clip changes it's x/y coordinates when a navigation button is clicked. For example, when the "News" section is clicked, the main stage changes to 300x100.
There are a few sites that i've seen do this. Any places I can look or any code out there?
Dynamically Resizing Flash Piece
This question is in regards to the following site, which many of you may be familiar with - http://www.pdk.pl/index_feng.html
Does anyone know how they have dynamically resized the flash piece in this site?. When you click on one of the buttons (for example click on the blue 'What documents do I need' over on the right hand side) the flash piece extends left and right to both edges of the browser (which I can do) but it also extends downwards towards the bottom of the screen and then down past the bottom of the screen bringing the scrollbar into play (unless you're on a giant monitor).
How have they done this?, Can anyone help with this or give me a push in the right direction.
Thanks,
Stephen.
Resizing Jpgs Loaded Into A Mc Dynamically
I have a drag and drop card wizard. Where there are at least 3 hit test areas. If the hit test is true the dragable button loads a external jpg into the mc holder.
What I would like to do is have the jpeg dynamically resize to fit the empty mc. Each hit area/mc holder for the jpeg are different sizes, so I would like the jpeg to accomadate the mc holder.The mc holders need to be a set size.
Any help with this is so appreciated! Thanks all in advance.
[F8] Dynamically Resizing Textfield Width
Hello, all.
I am trying to fill in a dynamic text field with a piece of text that is of variable length. I want to make the dynamic text field adjust its width so that it is always the same width as the text inside of it, but cannot figure out how to do so. Does anyone know of a way?
I tried this:
Code:
myTextField._width = myTextField.text.length*myTextField.textWidth;
But that ends up with my text field being far smaller than the text inside of it.
If anyone could point me in the right direction I would be much obliged.
Girasquid.
[F8] Dynamically Scrolling, Resizing Text
Anyone see an FLA similar to this tsunami-ish effect over on Lynda.com's home page ...
trainingbanner.swf
It's a scrolling list which responds to mouse movement and clicks.
The text and URLs are fed dynamically.
Tried to reach the designer without luck.
Resizing Dynamically Loaded Jpegs
Hi,
I am loading JPEGs into an MC called pictureHolderMC using "loadMovie" without a problem. But, the JPEGs are different sizes and I need them to be a constant width (100 pixels) so I am using the code below to set this:
Code:
_root.pictureHolder._width = 100;
But when I add this code the JPEG disappears from "pictureHolderMC". I know that "pictureHolderMC" is still there as I put a background colour block in it which still shows up, but without the JPEG.
Ultimately, I will write a function that also sets the "_height" property in proportion, but I need to get the basics of controlling the size to work first.
Any suggestions as to how o achieve this would be much appreciated.
AS3: Dynamically Resizing Background-picture
hi everybody.
I'm testing this idea of mine, but so far I've not been awarded succes.
so, here's what's my idea about:
I want to load a big background-picture into my Flash, and then I want it to be resized so it fits the screen-resolution that the user has on his/her browser.
see the example I've made so far, here:http://campjohn.dk/test/test100.html
it loads perfectly, and - from what I can see - keeps it's dimensions.
but it does not resize to the size of the browser as it should.
...if you go to the link, and then manually resize the browser-window, you'll get the resizing of the background-picture going on, though.
here's how it's all build:
I have a test100.fla with a test100.as Document Class
test100.as:
Code:
package {
import CustomBackgroundTest;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
public class test100 extends Sprite {
private var _customBackgroundTest:CustomBackgroundTest;
public function test100() {
init();
}
private function init():void {
stageInit();
customBackgroundTestInit();
firstResizing();
}
private function stageInit():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.BEST;
stage.frameRate = 30;
stage.showDefaultContextMenu = true;
stage.addEventListener(Event.RESIZE, onResize);
}
private function customBackgroundTestInit():void {
_customBackgroundTest = new CustomBackgroundTest(stage.stageWidth, stage.stageHeight);
addChild(_customBackgroundTest);
}
public function firstResizing():void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
public function onResize(event:Event):void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
}
}
see.. the init function calls a firstRezing-function which calls the same .onResize function as a manual resizing does.
so why does it only work when manually resizing the browser-window?
here's the customBackgroundTest.as:
Code:
package{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
public class CustomBackgroundTest extends Sprite {
private var _loader:Loader;
private var _request:URLRequest;
private var _stageWidth:Number;
private var _stageHeight:Number;
public function CustomBackgroundTest(stageWidth:Number, stageHeight:Number) {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
init();
}
private function init():void {
backgroundInit();
}
private function backgroundInit():void {
_loader = new Loader();
_request = new URLRequest("myBackground.jpg");
_loader.load(_request);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
addChild(_loader);
}
private function setSize(e:Event):void {
_loader.width = 1600;
_loader.height = 1200;
_loader.removeEventListener(Event.COMPLETE, setSize);
}
public function onResize(stageWidth:Number, stageHeight:Number):void {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
var ratio:Number = _loader.width / _loader.height;
if ((_stageWidth / ratio) >= _stageHeight) {
trace("_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.width = _stageWidth;
_loader.height = (_stageWidth / ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
else {
trace("!_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.height = _stageHeight;
_loader.width = (_stageHeight * ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
}
}
}
as you can see, there's lots of traces in .onResize function.
these I've used to trace, what is actually going on.
when the backgroundpicture is loaded at first the onResize-function traces this:
_stageWidth = 400 & _stageHeight = 300
_loader.width = 0 & _loader.height = 0
and when the .swf is manually resized this is what is traced out:
_stageWidth = 1087 & _stageHeight = 661
_loader.width = 1087 & _loader.height = 815.25
this might be the problem, but right now I'm too confused from looking at this over and over again... anyway, it seems strange, that the _loader.height which is set to the _stageHeight (which is 300) turns out to be 0!
all the files are downloadable here:http://campjohn.dk/test/resizing.zip
can anyone help me solve my problem?
thanks a lot
felisan
Dynamically Resizing Flash Piece
This question is in regards to the following site, which many of you may be familiar with - http://www.pdk.pl/index_feng.html
Does anyone know how they have dynamically resized the flash piece in this site?. When you click on one of the buttons (for example click on the blue 'What documents do I need' over on the right hand side) the flash piece extends left and right to both edges of the browser (which I can do) but it also extends downwards towards the bottom of the screen and then down past the bottom of the screen bringing the scrollbar into play (unless you're on a giant monitor).
How have they done this?, Can anyone help with this or give me a push in the right direction.
Thanks,
Stephen.
Resizing Media Components Dynamically
Does anyone know of a way to resize the MediaController component dynamically based on the size of the stage? When I just change its height/width properties, it stretches it. Not quite what I'm looking for.
If I resize it manually by changing the dimensions in the property inspector, it adjusts nicely. What I want is for the player to scale, but the buttons and icons to stay the same size.
Thanks in advance.
Sean
Movieclip Behavior When Dynamically Resizing
I have a simple movieclip (a short horizontal line). When I try to dynamically resize its width:
line._width += 100;
the line becomes fatter as well as longer. Why is this and how do I get around this problem?
Dynamically Resizing Flash Piece
Guys,
I came across a tutorial on how to resize frames dynamically somewhere on the net but have searched everywhere and cannot find it.
I am trying to resize each page so that if the browser scrollbar is not required, it can be removed. I know this can be done, but I'm not sure how.
Can someone push me in the right direction please.
Kind regards,
5leander5
Dynamically Resizing A Movie (hell)
I have been searching forum, tutorials and under tables for weeks on this one but still no joy, perhaps someone out there can help, or perhaps there is some sort of conspiricy to keep it from me.
I wish to dynamically resize my movie to fit the entire browser window. This in itself is of coarse no problem, but I do not want the contents of my movie to scale with it. I have found one Javascript resource for this but it causes the Flash content to centre when I require it to align where I choose.
This style of resizing is becoming more and more popular, expecially with the advent of interesting math interactivity, yet there seems to be no information floating arounf the net about how its done.
Does anyone have a suggestion, tutorial or some sourcecode on this????
Dynamically Resizing Background Movie
Hi,
I run across this cool web site
http://www.hi-res.net/
I'd like to add that effect on my own page. Can anybody explain how you can insert a full-screen, scalable movie clip as the background, and put a static menu plus text on the foreground?
Dynamically Resizing Flash Window
Hello,
I very much like this concept:
http://www.kirupa.com/developer/mx2004/swf/myfile.html
which is described in detail here:
http://www.kirupa.com/developer/mx2004/fullscreen.htm
In that example, the item looks fine if the window is 230 px by 250 px or larger. But if the window is too small then part of the item is not displayed.
I would like for it to work as it does with one exception:
If the window size is SMALLER than 230 px by 250 px then the flash object should dynamically become smaller, as it does here:
http://www.kirupa.com/developer/mx2004/swf/myfile.swf
I am sure this can be done with JS.
Any ideas how?
Thanks!
Loading Jpegs Dynamically And Resizing
Hi everyone. I am having a little trouble doing exactly what it is i want to do... I want to load JPG's dynamically into a movie clip. I started out using a loader component, but the loader only loaded the jpg half of the time.... so after a little research i used a movie clip and the loadMovie() method. Works all the time, only problem is i want to scale the size of the picture to fit where it should. I have upload code so the users can upload pictures to the server easily, so pictures will be of different sizes, so using _xscale and _yscale is out. I considered using server size code to resize the photos as they are uploaded, but am hoping there is an easier way. Anyone got any ideas?
AS3: Dynamically Resizing Background-picture
hi everybody.
I'm testing this idea of mine, but so far I've not been awarded succes.
so, here's what's my idea about:
I want to load a big background-picture into my Flash, and then I want it to be resized so it fits the screen-resolution that the user has on his/her browser.
see the example I've made so far, here:
it loads perfectly, and - from what I can see - keeps it's dimensions.
but it does not resize to the size of the browser as it should.
...if you go to the link, and then manually resize the browser-window, you'll get the resizing of the background-picture going on, though.
here's how it's all build:
I have a test100.fla with a test100.as Document Class
test100.as:
Code:
package {
import CustomBackgroundTest;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
public class test100 extends Sprite {
private var _customBackgroundTest:CustomBackgroundTest;
public function test100() {
init();
}
private function init():void {
stageInit();
customBackgroundTestInit();
firstResizing();
}
private function stageInit():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.BEST;
stage.frameRate = 30;
stage.showDefaultContextMenu = true;
stage.addEventListener(Event.RESIZE, onResize);
}
private function customBackgroundTestInit():void {
_customBackgroundTest = new CustomBackgroundTest(stage.stageWidth, stage.stageHeight);
addChild(_customBackgroundTest);
}
public function firstResizing():void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
public function onResize(event:Event):void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
}
}
see.. the init function calls a firstRezing-function which calls the same .onResize function as a manual resizing does.
so why does it only work when manually resizing the browser-window?
here's the customBackgroundTest.as:
Code:
package{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
public class CustomBackgroundTest extends Sprite {
private var _loader:Loader;
private var _request:URLRequest;
private var _stageWidth:Number;
private var _stageHeight:Number;
public function CustomBackgroundTest(stageWidth:Number, stageHeight:Number) {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
init();
}
private function init():void {
backgroundInit();
}
private function backgroundInit():void {
_loader = new Loader();
_request = new URLRequest("myBackground.jpg");
_loader.load(_request);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
addChild(_loader);
}
private function setSize(e:Event):void {
_loader.width = 1600;
_loader.height = 1200;
_loader.removeEventListener(Event.COMPLETE, setSize);
}
public function onResize(stageWidth:Number, stageHeight:Number):void {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
var ratio:Number = _loader.width / _loader.height;
if ((_stageWidth / ratio) >= _stageHeight) {
trace("_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.width = _stageWidth;
_loader.height = (_stageWidth / ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
else {
trace("!_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.height = _stageHeight;
_loader.width = (_stageHeight * ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
}
}
}
as you can see, there's lots of traces in .onResize function.
these I've used to trace, what is actually going on.
when the backgroundpicture is loaded at first the onResize-function traces this:
_stageWidth = 400 & _stageHeight = 300
_loader.width = 0 & _loader.height = 0
and when the .swf is manually resized the is what is traced out:
_stageWidth = 1087 & _stageHeight = 661
_loader.width = 1087 & _loader.height = 815.25
this might be the problem, but right now I'm too confused from looking at this over and over again... anyway, it seems strange, that the _loader.height which is set to the _stageHeight (which is 300) turns out to be 0!
can anyone help me solve my problem?
all the files are downloadable here:
thanks a lot
felisan
AS3: Dynamically Resizing Background-picture
hi everybody.
I'm testing this idea of mine, but so far I've not been awarded succes.
so, here's what's my idea about:
I want to load a big background-picture into my Flash, and then I want it to be resized so it fits the screen-resolution that the user has on his/her browser.
see the example I've made so far, here:http://campjohn.dk/test/test100.html
it loads perfectly, and - from what I can see - keeps it's dimensions.
but it does not resize to the size of the browser as it should.
...if you go to the link, and then manually resize the browser-window, you'll get the resizing of the background-picture going on, though.
here's how it's all build:
I have a test100.fla with a test100.as Document Class
test100.as:
Code:
package {
import CustomBackgroundTest;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
import flash.events.Event;
public class test100 extends Sprite {
private var _customBackgroundTest:CustomBackgroundTest;
public function test100() {
init();
}
private function init():void {
stageInit();
customBackgroundTestInit();
firstResizing();
}
private function stageInit():void {
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.quality = StageQuality.BEST;
stage.frameRate = 30;
stage.showDefaultContextMenu = true;
stage.addEventListener(Event.RESIZE, onResize);
}
private function customBackgroundTestInit():void {
_customBackgroundTest = new CustomBackgroundTest(stage.stageWidth, stage.stageHeight);
addChild(_customBackgroundTest);
}
public function firstResizing():void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
public function onResize(event:Event):void {
_customBackgroundTest.onResize(stage.stageWidth, stage.stageHeight);
}
}
}
see.. the init function calls a firstRezing-function which calls the same .onResize function as a manual resizing does.
so why does it only work when manually resizing the browser-window?
here's the customBackgroundTest.as:
Code:
package{
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
public class CustomBackgroundTest extends Sprite {
private var _loader:Loader;
private var _request:URLRequest;
private var _stageWidth:Number;
private var _stageHeight:Number;
public function CustomBackgroundTest(stageWidth:Number, stageHeight:Number) {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
init();
}
private function init():void {
backgroundInit();
}
private function backgroundInit():void {
_loader = new Loader();
_request = new URLRequest("myBackground.jpg");
_loader.load(_request);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, setSize);
addChild(_loader);
}
private function setSize(e:Event):void {
_loader.width = 1600;
_loader.height = 1200;
_loader.removeEventListener(Event.COMPLETE, setSize);
}
public function onResize(stageWidth:Number, stageHeight:Number):void {
_stageWidth = stageWidth;
_stageHeight = stageHeight;
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
var ratio:Number = _loader.width / _loader.height;
if ((_stageWidth / ratio) >= _stageHeight) {
trace("_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.width = _stageWidth;
_loader.height = (_stageWidth / ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
else {
trace("!_stageWidth / ratio");
trace("_stageWidth = "+_stageWidth+" & _stageHeight = "+_stageHeight);
_loader.height = _stageHeight;
_loader.width = (_stageHeight * ratio);
trace("_loader.width = "+_loader.width+" & _loader.height = "+_loader.height);
}
}
}
}
as you can see, there's lots of traces in .onResize function.
these I've used to trace, what is actually going on.
when the backgroundpicture is loaded at first the onResize-function traces this:
_stageWidth = 400 & _stageHeight = 300
_loader.width = 0 & _loader.height = 0
and when the .swf is manually resized this is what is traced out:
_stageWidth = 1087 & _stageHeight = 661
_loader.width = 1087 & _loader.height = 815.25
this might be the problem, but right now I'm too confused from looking at this over and over again... anyway, it seems strange, that the _loader.height which is set to the _stageHeight (which is 300) turns out to be 0!
all the files are downloadable here:http://campjohn.dk/test/resizing.zip
can anyone help me solve my problem?
thanks a lot
felisan
Dynamically Resizing List Component
PLEASE HELP!!
i want the height of my lists to resize dependent on the amount of content, therefore negating the need to have scrolbars.
thanks
Dynamically Resizing A Text Field - Doable?
Hey hey,
i'm filling a text field with variables from an external text file, but i dont know how much text there will be. is there a way increase the height of the text field depending on a known number of variables?
eg
textfield._height = 50 * num_of_var;
i'm not sure how to reference the text field since you can't name it. it is inside a movie clip but i don't want to stretch the MC, just the text field inside it.
FK
Dynamically Setting Text And Resizing Canvas
Hi
setting text
I'm made a button in which I put a dynamic text box, and gave it the instance name "caption". I removed it from the canvas, since it gets added using the attachMovie method. The caption comes from the html in the form of <PARAM NAME=movie VALUE="mymovie.swf?btn1=Click+Here">
I know that this parameter is loading, so that's no problem.
The problem is, that this value does not get loaded into the textbox.
I attach the button in the root:
Code:
attachMovie("btnTemp_exp", "button" + x, x);
with (_root["button" + x]) {
_x = 1;
_y = (_root["button" + x]._height * i) + 1;
_caption.text = eval("btn" + x);
}
I checked, and eval("btn" + x) returns the value of the passed parameter. the buttons get attached. When I do this:
Code:
trace(_root["button" + x]);
the result is:
_level0.button1
but when I do this:
Code:
trace(_root["button" + x].caption);
// caption is the instance of the textbox
the result is:
undefined
what am I doing wrong?
resizing canvas
I'm also trying to resize the canvas using actionscript. my button's height is 20. I want to specify in the params how many buttons I have, and pass their captions as well. if I have 3 buttons, the canvas's height should be 60. If I have 5 buttons, it should be 100. I managed to do this using actionscript, but the buttons stretch with the canvas. this means that if my original canvas's height was 20, and I want 3 buttons, it will now, be 60, but the button's height is also 60. I've seen flash movies that appear to be doing the same thing. Am I dillusional, or is there a way to do this?
Thanx in advance
Masking / Resizing Dynamically Imported Jpgs
Hello All,
I am making a photo gallery app that I would like to be able to give to different clients and will be customizable. Right now it is all controlled by a txt file that allows the user to put all images in the same folder and and the text file assigns them their names that will be used in the scripting. I can get the images to load using either loadMovie() or loadMovieNum() , but the problems I have is either setting the xScale & yScale to maintain size consistancy. or masking out parts of the image that are beyond what I want to be the viewable area. I am also having issues in assigning the dynamicly loaded jpgs their _x & _y.
any help would be appreciated
Resizing Container To Fit A Dynamically Loaded File
what's up? is there any way to have a container resize itself to the size of an externally loaded file such as a jpg?
right now i'm making a portfolio with many different pics, animations etc. to keep the file size down i'm storing all of my main files in an array and loading them via the loadMovie(); function. here is the problem:
there is a square on the screen in which is an empty movieclip that i'm using to load the file into. laying on top of this empty movieclip in a layer on top of it, i have a white outline that acts as a frame. i'd like the CONTAINER to scale itself to match that of the loaded file and also would like to have the FRAME layer to scale itself accordingly.
please help
thanks
itriix
|