_width Vs _xscale
hello!
i'm dynamically loading a bunch of jpg images, and i display them next to each other in a "stripContainer" MC.
Say, each image is 266px width.
i would like to display each image shrinked horizontally to 5px (Don't ask why) .
i tried setting the width of the movieClip in which the image is loaded to 5px, but it seems it then only displays the 5 first pixels of the image it contains (thus cropping) instead of compressing its width.
_xscale is more like what i need, but it does not allow to fix the width to 5px since it is a percentage.
Anyone has an idea on how to solve this?
thank you,
Alex
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 06-18-2007, 01:28 PM
View Complete Forum Thread with Replies
Sponsored Links:
Conflicts With _xscale And _width
I set the height and width of an mc with
code:
map._width = (Math.ceil(stageW-100));
map._height = (Math.ceil(stageH-100));
stageW and stageW are set by
code:
stageW = Stage.width;
stageH = Stage.height;
this is fine since i am using _width and _height to set the mc size this should mean the _xscale and _yscale should remain 100%. This does not seem to be the case and is causing headaches for me.
--
Here's were am @:
I have a global map that loads into my website, stageW and stageH are set in the main movie.
Once the map starts to load it checks the height and width of the mina maovie and then sets it's size with that. this is all fine and all starts to bugger up once i try to use _xscale and _yscale of the map.
Anyone any ideas to a solution.
cheers
Paul
--------------
senocular:
Quote:
_width and _height are related to _xscale and _yscale. When _width changes, _xscale reflects that change; when _height changes, _yscale reflects that change. The same applies the other way around.
If you need to be in a situation where you need to change the width/height without changing the _xscale or _yscale properties, then put that movieclip within a containing movieclip and scale change the original movieclips size within. Then you can use the container movieclip as "the" movieclip as its _xscale and _yscale will have remained 100% despite the change of size within.
View Replies !
View Related
Conflicts With _xscale And _width
I set the height and width of an mc with
Code:
map._width = (Math.ceil(stageW-100));
map._height = (Math.ceil(stageH-100));
stageW and stageW are set by
Code:
stageW = Stage.width;
stageH = Stage.height;
this is fine since i am using _width and _height to set the mc size this should mean the _xscale and _yscale should remain 100%. This does not seem to be the case and is causing headaches for me.
--
Here's were am @:
I have a global map that loads into my website, stageW and stageH are set in the main movie.
Once the map starts to load it checks the height and width of the mina maovie and then sets it's size with that. this is all fine and all starts to bugger up once i try to use _xscale and _yscale of the map.
Anyone any ideas to a solution.
cheers
Paul
View Replies !
View Related
Conflicts With _xscale And _width
I set the height and width of an mc with
ActionScript Code:
map._width = (Math.ceil(stageW-100));
map._height = (Math.ceil(stageH-100));
stageW and stageW are set by
ActionScript Code:
stageW = Stage.width;
stageH = Stage.height;
this is fine since i am using _width and _height to set the mc size this should mean the _xscale and _yscale should remain 100%. This does not seem to be the case and is causing headaches for me.
--
Here's were am @:
I have a global map that loads into my website, stageW and stageH are set in the main movie.
Once the map starts to load it checks the height and width of the mina maovie and then sets it's size with that. this is all fine and all starts to bugger up once i try to use _xscale and _yscale of the map.
Anyone any ideas to a solution.
cheers
Paul
View Replies !
View Related
Component Width, _width And _xscale Confusion
Having struggled with creating my own Flash MX 2004 component for sometime, I am going to throw this question out there in the hope some flash expert can help.
Things seem to be going wrong with the sizing of my component. I read somewhere that just before or after sizing objects in the draw() method you need to set the scaling back to 100%.
Am I right in thinking this, or are you meant to do it in the size method? Or am I completely wrong and don't need to do it at all?
Thanks.
View Replies !
View Related
_width & _height VS. _xscale & _yscale - The Wierdness Continues
Hi,
I had a problem which I've just "fixed" (quotes used for emphasis as I have NO idea why the "fix" works!).
I found a whole bunch of similar threads but none exactly like the issue I was facing.
I'm working on a class which creates a TextField within a container MovieClip. The class has an Object called destination which store's "destination" properties of the MovieClip - _x, _y, _height, _width, _rotation etc.
The class also has a function called resetState() which copies all the properties in the destination object to the MovieClip (thus reseting the MovieClip's state to that of the destination object).
Everything worked fine. I'd set destination._x to 200, call resetState() and as expected the MovieClip's _x property would be set to 200.
However, if I set destination._height or destination._width and call resetState() nothing happens!?!
After much hair pulling I tried destination._yscale = 200 and magically the MovieClip's _yscale property changed to 200!
Now, here's the really strange part. Below is the code for resetState() all pretty simple stuff:
Code:
public function resetCurrentState() {
for( var prop in _dest)
_mc[prop] = _dest[prop];
}
And here is how I got resetState() to change the MovieClip's _width and _height:
Code:
public function resetCurrentState() {
for( var prop in _dest)
_mc[prop] = _dest[prop];
_mc._width = _dest._width;
_mc._height = _dest._height;
}
I understand that loading dynamic data (images/MovieClips etc.) can cause a similar problem if time is not allowed for the data to be fully loaded, however this is a simple MovieClip with no external data used - hell I'm not even trying to access the _width and _height property's until some time after the MovieClip has been created!?
If anyone has any idea's as to why the _width and _height propertys have to be implicitly set I'd really like know!
:theory
View Replies !
View Related
How Do I Get The Timing Among Mc's Using _xscale+=(goal-_xscale)/5;
I'm using this code to transform a rectanglar mask to have the mask hide a picture while it switches to the next picture.
"_xscale+=(goal-_xscale)/5;"
So things need to go in this order:
1. Button gives the 0 goal to mask, mask covers picture.(or uncovers really, mask style, but the visual effect is it gets covered by the underlying bg color.)
2. Button tells the pic mc to load a new pic dynamically.
3. Button tells mask goal=100, which reveals the new pic.
The problem I'm having is getting the pic to begin loading only after the mask has reached the 0 goal, and getting the mask to go back to 100 only after the pic is fully loaded under it. How can they communicate the timing with each other?
The pic swapping clip and the mask clip are both children of the same clip. I know this could be done with tweens & mc timelines, but I'd rather learn as much code as I can as opposed to taking the easy way.
Thanks for helping this newby!
View Replies !
View Related
_xscale
Hardcore newbie question.
why does this return undefined:
trace(MC2._xscale);
I'm trying to scale a movie clip, but can't seem to get at its properties.
-- Jenni
View Replies !
View Related
_xscale
Hello there!
I am almost done with my preloader, only one thing is not working. The loading bar that graphicall represents the % loaded is supposed to be controlled with the _xscale property. However, when I write bar._xscale = procentage the bar expands in both directions, left and right. So how do I make the bar expand only in one way, to the right?
Regards
George
View Replies !
View Related
_Xscale ONLY
Hi,
I am using Laco's MC Tween function and am having trouble with getting my MC to scale just horizontally, it works the first time using the below code, but the next time it is rolled over it scales from (0,0)...
Code:
on (rollOver) {
butTop1.scaleTo(100, 1, "easeOut");
butTop1.alphaTo(30, .5, "easeOut");
}
on (rollOut) {
butTop1.alphaTo(0, .5, "easeOut");
butTop1.scaleTo(0, 1, "easeOut");
}
on (rollOver) {
butBot1.scaleTo(100, 2, "easeOut");
butBot1.alphaTo(40, .5, "easeOut");
}
on (rollOut) {
butBot1.alphaTo(0, .5, "easeOut");
butBot1.scaleTo(0, 1, "easeOut");
}
Thanks in advance!
Tom
View Replies !
View Related
[F8] _xscale
I have made it so when you turn left and right on the side scrolling game thing that the sprite turns left and right as well using _xscale= -40/40
but whenever I turn what happens is it jumps.
e.g ______0-9______ but instead of going to ______9-0______ the other way round, it goes to __9-0__________ on the other side of the screen. can anyone help? code is:
if (Key.isDown(Key.Left)){
this._x -=11
_xscale =-40
}
if (Key.isDown(Key.Right)){
this._x +=11
_xscale =40
}
View Replies !
View Related
_xscale
I have a preloader in my game..as of now i'm just using _xscale for the loading bar, and what it does is go from the middle outwards. Can I somehow make it so that the bar will expand from left to right, using xscale(preferably) or some other variable. The width of it has to be a percentage, not a set number, because with xscale, I tell it to getBytesLoaded()/getBytesTotal()*100...which makes a percentage.
View Replies !
View Related
_xscale Loading Bar
Ok, I'm working on a loading script for a flash I'm making. I would like to put a progress bar to dynamically show the percent of the flash that's loaded. I already have done a script that displays the percent in a text form using percent=(_totalframes/_framesloaded) now I want to use _xscale on my loading bar to have the value of the varible $percent. The only problem is... HOW DO I DO IT???
I can't seem to understand how I would go about assigning the _xscale poperty value of my loading bar to equal the varible percent... If anyone could help me out... PLEASE FILL ME IN!!!
View Replies !
View Related
_xscale And _x/_y And _alpha Help?
ok... i have this script that at the momment moves my movie clip around the stage when i click the button. this is the script:
first frame:
shapeY = _parent._Y;
shapeX = _parent._X;
targetY = 0;
targetX = 0;
and on the second frame:
if (_parent._currentframe == 2) {
targetY = 446;
targetX = 446;
distY = targetY-shapeY;
distX = targetX-shapeX;
shapeY = Math.round(shapeY+(distY/5));
shapeX = Math.round(shapeX+(distX/5));
_parent._y = shapeY;
_parent._x = shapeX;
}
so as it stands, when the parent movie clip changes to frame 2, the MC moves smoothly to the designated x y co-ordinates.
ok. so this all works fine, but i want to scale to the designated area too. so when the parent movie clip goes to frame 2 i want to go to the designated co-ordinates and scale in or out at the same time i also wnat to control the alpha (so dots in the background get paler.
any help would be greatly appreciated.
Mallrat68
View Replies !
View Related
_xscale On Only One Side?
Hello All. I am trying to make an object scale in width but only from one side. I currently have the following actions on my MC:
onClipEvent (load) {
new_width = _width;
ease = 3;
}
onClipEvent (enterFrame) {
_width += (new_width-_width)/ease;
}
and on the button I have:
on (press){
MC.new_width=200;
This works but it scales the MC from both sides and I would like it to scale only from the left.
Does anyone know how to do this? Any help is greatly appreciated.
View Replies !
View Related
Stopping _xscale
Hi, ive got a bar and its _xscale is increased in each frame. This is the code im using.
code: //Set Size at start
onClipEvent (load) {
_xscale = 0;
}
//Make the bar longer by 10 each frame
onClipEvent (enterFrame) {
_xscale = _xscale + 10;
//If its over 100 send it back to 0
if (_xscale > 100) {
_xscale = 0;
}
}
But I want the bar to stop in the position it is in when the mouse is clicked. Ive tried a few different things but nothing has worked. Can some one help, thanks
View Replies !
View Related
AttachMovieClip + _xscale
Problem:
My mc is attached dynamically using attachMovieClip.
I want to flip the mc using:
_xscale *= -1;
I can't! It flips excactly once and then returns to _xscale = 100; Although I can add to _xscale's value using:
_xscale += 50;
I suspect that it has to do with attaching the mc dynamically since this code works nicely with non-attached mc's.
Code:
if(this.flipVar == true){
this._xscale *= 0.8;
if(this._xscale < 1){
_xscale *= -1;
this.flipVar = false;
}
}
if(this.flipVar == false){
this._xscale /= 0.8;
if(this._width >= this.flipWidth){
this.flipVar = true;
}
}
Does anyone know how to work around this? Even when I place the _xscale *= -1 in onEnterFrame=function() it only flips once and then returns to _xscale = 100 again... When it should flip back and forth on every frame???
View Replies !
View Related
_xscale And _yscale
I have a character and i want to scale him with this way.
PHP Code:
_root.onEnterFrame = function(){
_level0.xscale = Number(_root.joshy._y-=10);
_level0.yscale = Number(_root.joshy._y-=5);
_root.joshy._xscale = Number(_level0.xscale);
_root.joshy._yscale = Number(_level0.yscale);
}
It's ok, when char moves up, scale will go down etc.
BUT here's a problem, char move up by himself. But i need him to stop.
There's probably something in the script but i don't know what. Please help
Cheers
View Replies !
View Related
EaseInOut With _xscale
hi
I'm using the following code to move an object
Code:
ball_mc.onRollOver = function() {
tweenBall();
};
function tweenBall() {
easeType = mx.transitions.easing.Strong.easeInOut;
var beginX = _level0.ball_mc._x;
var endX = Math.floor(Math.random()*550)+1;
var beginY = _level0.ball_mc._y;
var endY = Math.floor(Math.random()*400)+1;
var beginXscale = 50;
var endXscale = 50;
var beginYscale = 50;
var endYscale = 50;
var time = .2;
var mc = ball_mc;
ballXTween = new mx.transitions.Tween(mc, "_x", easeType, beginX, endX, time, true);
ballYTween = new mx.transitions.Tween(mc, "_y", easeType, beginY, endY, time, true);
ballXscaleTween = new mx.transitions.Tween(mc, "_xscale", easeType, beginXscale, endXscale, time, true);
ballYscaleTween = new mx.transitions.Tween(mc, "_yscale", easeType, beginYscale, endYscale, time, true);
}
the trouble I'm having is with _xscale and _yscale
what I'd like is for the object to get bigger as the tween eases in and then shrink back to its original size on ease out
the problem (as you can see from the code) is that there's no way to specify the size that the object must reach in the middle of the tween.
Does this mean i need to use two tweens - an easeIn tween followed by an easeOut tween ?
and if so - is there a callback function that indicates when the first tween has finished ? - kind of like
ballYscaleTween.onFinishTween()
thanks
View Replies !
View Related
_xscale NO _yscale
Hi,
I am using Laco's MC Tween function and am having trouble with getting my MC to scale just horizontally, it works the first time using the below code, but the next time it is rolled over it scales from (0,0)...
Code:
on (rollOver) {
butTop1.scaleTo(100, 1, "easeOut");
butTop1.alphaTo(30, .5, "easeOut");
}
on (rollOut) {
butTop1.alphaTo(0, .5, "easeOut");
butTop1.scaleTo(0, 1, "easeOut");
}
on (rollOver) {
butBot1.scaleTo(100, 2, "easeOut");
butBot1.alphaTo(40, .5, "easeOut");
}
on (rollOut) {
butBot1.alphaTo(0, .5, "easeOut");
butBot1.scaleTo(0, 1, "easeOut");
}
Thanks in advance!
Tom
View Replies !
View Related
Incorporating _xscale
hi,
There's a link to an fla file in a zip file at the bottom.
Right now the film strip slides back and forth, which is part of what i want it to do.
What I am trying to figure out is to also have it scale up at the end of the slide AND to scale down when a button is pressed and continues to slide.
So the order of events would be
1. slide
2. scale up
3. stop
4. button is clicked and strip scales down and then slides.
I'd imagine it is _xscale, but I can't quite figure it out. No i don't have an _xscale in there currently.
To see what I am talking about. Click left most blue circle > click services. From there you can click whatever buttons on the left column to move the slider.
You can click on it here to download a zip file:
http://www.imagine-that.us/if.zip
View Replies !
View Related
_xscale Bar Problem
hey,
Back again for some advice. Can't get enough of it.
I have a loading bar "loadingbar_mc" which tells me how much of an mp3 is loaded.
What I want is this to happen...
www.buildrebuild.com
For reasons that I won't bore you with I need that button clip to be attached at the end of the loadingBar_mc at all times during the loading process.
I could attach it in the loadingBar_mc but the _xscale of the button would be shrunk at the start of the load only progressing to it's full _xscale at the end.
Any help.Pleeeaaase.
Thx in advnce
Best
BRb
View Replies !
View Related
Possible To Let Mc _xscale Itsself?
hi,
i have a movie that i would like to _xscale with an interval.
So i have a function on that movie that defines an interval. That interval calls another function on the same frame, that should let the movie grow 10x its original size, and then clear the interval.
So in the latter function i use 'this._xscale +=10', everytime the function is called by the interval.
The only problem is that 'this' is undefined and '_xscale' too
Any suggestions anyone?
Thx!
View Replies !
View Related
_xscale Class
hello,
does somebody know where in my program files, I can find the class that calculates the _xscale value?
I try to generate it for a class file.
It would even be better if I could import the existing script, because there is always a small difference after the comma.
View Replies !
View Related
_xscale Bar Problem
hey,
Back again for some advice. Can't get enough of it.
I have a loading bar "loadingbar_mc" which tells me how much of an mp3 is loaded.
What I want is this to happen...
www.buildrebuild.com
For reasons that I won't bore you with I need that button clip to be attached at the end of the loadingBar_mc at all times during the loading process.
I could attach it in the loadingBar_mc but the _xscale of the button would be shrunk at the start of the load only progressing to it's full _xscale at the end.
Any help.Pleeeaaase.
Thx in advnce
Best
BRb
View Replies !
View Related
_xscale & _yscale Help
Tyring to get the infinite menu script from this site to scale the buttons on rollOver without overlapping each other.
I would like the menu to scale and move relative to each button that is rolled over.
Is there anyone that can help???
check example link
http://paragon.sortismarketing.com
View Replies !
View Related
_xscale And _yscale Without Tweens?
I'm trying to create the code that would track the _xmouse and _ymouse so that when placed over a movie clip the movie clip would double in (x & y scale) without using any tweens. I want the clip to grow in size... not just jump to 200% in size. When the mouse is moved off of the movie clip I would like to reverse the growth process back to 100% scale. All code no tweens and a bucket of green beens. =)
Has anyone got a clue on this?
Thanks,
Kirk
View Replies !
View Related
New _xscale Mouse Postion
HI_ I am having a problem not to different than the one a few of messages down. I am able to xscale a movieclip on mouse postion but my problem is with negative numbers. I have the mouse postion centered to my movieclip so when mouse x postion = 0 the movieclips _xscale = 0. What I want to happen is when mouse x postion = 0 the movieclips _xscale = 100 reversing so that as the mouse gets nearer the movieclip the movieclip grows. If any one can help it would be great as I am having many problems with this.
THANKS ALLOT_ JODY
jodyhp@blueyonder.co.uk
View Replies !
View Related
#### _xscale & _yscale Problem ####
HI, first time post!
1. Does the value of _xscale & _yscale in %?
eg. this._xscale = 200;
// does it mean the mc will has a 200% larget size in _width?
but I have seen a code like that
onClipEvent(load) {
scaleAMT = 10;
x = 525;
y = 25;
}
onClipEvent(enterFrame) {
scaleAmt++;
x -= 5;
y += 5;
this._xscale = scaleAmt;
this._yscale = scaleAmt;
this._x = x;
this._y = y;
}
The movie clip is moving and becoming larger!!!!! But the _xscale & _yscale's value is 10..11...12...13...14...15.......only (<100)...
So how come the mc is becoming larger instead than smaller????
Very confuse....pls help!!!!
View Replies !
View Related
Controlling An MC _xscale And _yscale With AS
Hi - I've had a look around the forums for information on this, and I think I have it, but as usual it's probably one small thing that is not making it work. I have a simple menu made of different size circles that I want to throb slowly (ie increase and decrease in size slowly).
A motion tween would do the trick if the MC didn't have to do anything else, but I'm aiming to increasing the size of a circle if it is 'moused over', therefore AS has to be used.
I have created a MC for the Circle and a MC holder for that first MC ie _root/Circle_holder/Circle. In the Circle MC, I have created 3 keyframes at 15fr intervals, the first keyframe, the Object Action is:
onClipEvent (enterFrame) {
setProperty ("work", _xscale, 59.5);
setProperty ("work", _yscale, 72.7);
}
The second is:
onClipEvent (enterFrame) {
setProperty ("work", _xscale, 64.5);
setProperty ("work", _yscale, 77.7);
}
And finally the final frame Object Action is:
onClipEvent (enterFrame) {
setProperty ("work", _xscale, 59.5);
setProperty ("work", _yscale, 72.7);
}
On the last keyframe (30), the Frame Action is:
gotoAndPlay (1);
When the swf is played, nothing happens. What fundamental daft thing am I doing wrong?
thanks
frank
View Replies !
View Related
Getproperty + Image _xscale
is it possible to get _xscale from an image on a website? Im trying to do something like this
a = getProperty("http://www.lineagecompendium.com/images/smooch/smooch00842.jpg", _xscale);
that doesnt work.. but is there a way to make something like that that will work? i need the _xscale to later set the x for the movie clip, so it will display the image correctly
View Replies !
View Related
_xscale And _yscale Problem
I have a map in flash, wich can zoomed in and out. I've used buttons and they have code:
on (release) {
_root.kartta._xscale-=10;
_root.kartta._yscale-=10;
}
and
on (release) {
_root.kartta._xscale+=10;
_root.kartta._yscale+=10;
}
it works quite well, exept when I zoom out as much as I can it flips the map upside down and starts zooming it in..weird..what should I do?
View Replies !
View Related
Assigning _xscale... But It Won't Assign~ ?
Attached is my file...
on 1st frame of control layer i defined a function to calculate the distance between 2 points, and it works...
then i try assigning an mc (the up arrow) an _xscale value according to the distance between the mc and the mouse... but it won't assign...
_root.button_up_mc._xscale = (int(Cal_dist(_xmouse, _root.button_up_mc._x, _ymouse, _root.button_up._y)));
that's the assignment statement found in the control bob layer in a mc offstage to the left. i've tried to trace both sides of the assignment separately, but they NEVER match... why is that?
any help would be greatly appreciated!!
View Replies !
View Related
Help Looping To Find _xscale
I've run into a wall while trying to code an action during swapPage (the one that loads in new content) function which checks buttonsizes with _xscale and then tries to resize the button if the _xscale is too high. So far I've made this for loop to go through an array of pages in my site, checking each associated button to see if its size is erroneous. It might make sense if you visit this to see where I'm at so far:
http://dementiadesign.net/longboarding/main_shell.swf
I've gotten most of the button functionality to work, but the bug I'm dealing with is when you hover over one button, and quickly click on another, the button's size will left as the size as when you clicked. When I trace my buttonPath._xscale I keep on coming up with "undefined". My buttons are all located in the same MC with the same naming convention, "_root.topMenu_mc.buttonName_btn". Any ideas why this path isn't working to check to the _xscale? So my solution was this code within the swapPage function called when you click on a button:
for (i = 0; i < pages.length; i++) {
//buttonToCheck = pages[i];
buttonPath = "_level0.topMenu_mc."+pages[i]+"_btn";
trace(buttonPath._xscale); //this is not properly tracing the _xscale
trace(buttonPath) // buttonPath works fine
if (buttonPath._xscale > restSize && activeButton != buttonPath) {
delete buttonPath.onEnterFrame;
rollOutAction(buttonPath, pages[i]);
trace(buttonPath + " should be resized!!!");
}
}
View Replies !
View Related
_xscale & _yscale Mc - Simple As
Hi there, I need to fix my script. I'm trying to stop my sq_mc from continuosly scaling. Here's what I have;
Code:
stop();
this.sq_mc.onEnterFrame = function(){
this._alpha-=1;
this._xscale += 2;
this._yscale += 2;
if (this._alpha<11){
this._alpha = 10;
}
}
thanks
jb
View Replies !
View Related
_xscale And Stroke Thickening
Hey, I was just wondering if anyone knows if it's possible to _xscale a mc without having the stroke thicken? I have a box that scales only on the x axis and right now the stroke thickens as it x coord increases. Is there a work around? Thanks.
View Replies !
View Related
[MovieClip] _xscale & _yscale Help Please
I'm working on an apple mac type menu, I cant get it to work on both x and y axis though. Right now its only working on the y axis, whats wrong with my coding?
Add an MC to your workspace, paste the following code into the MC's script then compile & mouse over the MC. I want it to scale itself on horizontal approach AND vertical approach.
I'm using MX btw
Code:
onClipEvent (enterFrame)
{
mousey = _ymouse;
mousex = _xmouse;
if (mousex<0)
{
mousex = -1*mousex;
}
scale = 200-mousex;
if (scale<50)
{
scale = 50;
}
if (scale>200)
{
scale = 200;
}
if (mousey<0)
{
mousey = -1*mousey;
}
scale = 200-mousey;
if (scale<50)
{
scale = 50;
}
if (scale>200)
{
scale = 200;
}
setProperty ("", _yscale, scale);
setProperty ("", _xscale, scale);
}
View Replies !
View Related
_xscale Flip Horizontal
I'm trying to make my object flip horizontally when it travels to the right and flip back when it travels to the left.
this._xscale *= -1; This is the code I used, all it does is flip back and forth.
anybody know whats wrong.
onClipEvent (load) {
width = 900;
height = 388;
speed = Math.round(Math.random()*3)+1;
//initial positions
x = this._x=Math.random()*width;
y = this._y=Math.random()*height;
x_new = Math.random()*width;
y_new = Math.random()*height;
this._xscale = this._yscale=30+Math.random()*40 ;
}
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {
sign_x = 1;
} else {
sign_x = -1;
}
dx = Math.abs(x_new-this._x);
if ((dx>speed) || (dx<-speed)) {
this._x += sign_x*speed;
} else {
x_new = Math.random()*width;
this._xscale *= -1;
}
//y movement
if (y_new>this._y) {
sign_y = 1;
} else {
sign_y = -1;
}
dy = Math.abs(y_new-this._y);
if ((dy>speed) || (dy<-speed)) {
this._y += sign_y*speed;
} else {
y_new = Math.random()*height;
}
}
Thanks vxd
View Replies !
View Related
Writing An If Statement For _xscale
ok,
I am sure this is a bone head problem. I have the jist of writing an if statement but it doesn't work.
I want the box to stop growing or shrinking when _xscale = 10.
This is my code. It animates but dose not stop. How do I write a proper if statement for this. There is a box it's instance name is box on the main timeline.
thanks,
box.onEnterFrame = function (){
box._xscale = box._xscale + 2;
box._yscale = box._yscale + 2;
}
if (box._xscale=10) {
stop();
}
View Replies !
View Related
Walls Without Messing With The _xscale
Hi, can anyone tell me how to make my character not go through walls without modifying the _xscale when it touches a wall. I've read a lot of tutorials about this but they are all the same, they are somehing like this:
"Make your character a movieclip and add this actions:"
ActionScript Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.Wall)) {
_x = _x+10; }
}
(That code is incomplete, I just want to give the idea)
I don't need that because in my game the background is the one that moves (character only rotates) so the character is always centered. So if anyone could tell me how to do this it'll be great.
Thanks in advance
View Replies !
View Related
Problem With Tween And _xscale
hi All,
Lets say for a mo you have a movie clip on the time line with a text box inside, insert a few blank keyframes, make the movie clip bigger (transform), create a motion tween, move said movie clip.
Now, go into the movie clip and insert the line "_xscale = _yscale = 100;". Run it. For me it doesn't work. This is a simple example, but basically I'm trying to do up a component which designers can use on screen and then I can initialise later. Does anybody please have a suggestion of how I can circumnavigate this problem?
Troot
View Replies !
View Related
Actionscript _xscale From The Center
peepz,
my script:
Code:
this.onEnterFrame=function(){
this.mcPlace._x += Math.ceil((serviceEndX-this.mcPlace._x)/5);
trace(this.mcPlace._x);
if (this.mcPlace._x==serviceEndX) {
trace("ben er....")
this.mcPlace._xscale += Math.ceil((serviceXScale - this.mcPlace._xscale)/5);
if (this.mcPlace._xscale>=serviceXScale) {
trace("ben er....2222")
delete this.onEnterFrame;
}
}
}
my script moves with easing to the desired position and scales bigger (with easing) but its not scaling from the center its scaling from the left.
i got the ("pivot" , don;t now if they call it this way) in the center of the Movieclip
any ideas to scale it from the center ?
thnx peepz....
View Replies !
View Related
_xscale & _yscale Increments
Folks, I have a movie clip that I want the user to be able to scale up or down in increments of 10% by pressing the up and down buttons. I think I'm close, any help would be appreciated.
on (keyPress "<Up>") {
_root.myclip._xscale (110);
_root.myclip._yscale (110);
}
on (keyPress "<Down>") {
_root.myclip._xscale, (90);
_root.myclip._yscale, (90);
}
View Replies !
View Related
Tracing _xscale & _yscale
I'm moving my movieclip around and in order to make things work nicely I need to know the _xscale and _yscale values before and after the clip has been triggered, there are lots of variations but when I trace(myMC._xscale) & trace(myMC._yscale) the only values returned are 100 - anyone know why and how i can fix it?
dai2
View Replies !
View Related
Set _xscale And Y_scale Direction ?
I've got a movieclip that I want to scale when a button is clicked.
I'm using the tween class to make the scaling smooth. It works fine when I test the movie within flash, but when I preview it in a browser the movieclip scales in the wrong direction. That is it turns upside down and scales to negative x and y values.
Code:
twXscale = new Tween(holder, "_xscale", easing.Strong.easeOut, holder._xscale, 80, 1, true);
What's wrong ? Can I set the direction of the scaling or something ?
Thank you.
View Replies !
View Related
_xscale & _yscale Increments
Folks, I have a movie clip that I want the user to be able to scale up or down in increments of 10% by pressing the up and down buttons. I think I'm close, any help would be appreciated.
on (keyPress "<Up>") {
_root.myclip._xscale (110);
_root.myclip._yscale (110);
}
on (keyPress "<Down>") {
_root.myclip._xscale, (90);
_root.myclip._yscale, (90);
}
View Replies !
View Related
|