Set _x Position Of Object From Txt File
It's driving me crazy. looking for help. The game program writes txt file with result which will tel where to postion an object in flash movie. The example txt file called: variables.txt and it contains following message: variable=x=500. It si saved in the same folder as fla file. And I tried for test and cerate text box and movie shows corectly the text from variable.txt, but the object _x position do not move to 500. Here is script:
onClipEvent (load) {
loadVariables ("variables.txt", this);
}
onClipEvent (data) {
_x = x;
}
The attachment is fla file.
FlashKit > Flash Help > Flash ActionScript
Posted on: 04-11-2003, 05:13 AM
View Complete Forum Thread with Replies
Sponsored Links:
Position Object By Center Of Other Object And Stage Left...?
lol! :lol:
what i mean is i have an object (mc = main_logo) that centers itself upon load:
main_logo._x = Stage.width / 2;
main_logo._y = Stage.height / 2;
and i want another object (mc = helmet) to always load up 2/3rds to the left (x axis) of main_logo's center (counting left to right, 2/3rds between main_logos center and stage left border) and 200 pixels above (y axis) main_logo's center.
i know i keep asking these things and i'm not trying to have you all do every little thing for me, i am trying to learn this! it's just that my brain operates differently and i have to assimalate information by what i'm trying to accomplish...
thanks!
View Replies !
View Related
Y Position Always On Top Of An Object
Riiiight heyyyyy, my new question is... how do you make the y position of an object always be just above another object, e.g. on most games on the internet an object or "player" can move over other objects like "ground" and obstacles, in my quite simple game, I've been trying to get the ball to roll over a simple "floor" Mc using hitTest using
_y -- or _y -= 1 to get the object to stay over the floor, this works fine on horizontal "floor" but on parts where the floor raises it moves straight through it and goes up slowly if the ball remains inside the Mc until it reaches the top of it,
Is there a way to keep the ball constantly 1px above the Mc?
Thaaaaaaaanks in advanceeee!
View Replies !
View Related
Set Start Position Of Object
hi, I've created an object that sits onstage and that can be moved by four buttons. see attached. the buttons move it in an x or y direction.
I want to be able to set the initial position of the object to centre stage (at the moment it defaults to the top left corner of the stage, (0,0). I also want to retain the smooth gliding movement that the object has.
All I can think of is using "this._x = 200" and "this._y = 200", which positions the object but for some reason means that it no longer glides smoothly, instead it jumps when the buttons are pressed.
can anyone help me out with a way to position the object centre stage while keeping the smooth gliding movement? many, many thanks!
View Replies !
View Related
Random Position Of Object
i want to know how can i make the object changing its position randomly for two conditions simultaneously .. either i click on object then it should change its position or if i don't click with in 5 seconds then it should automatically change its position .
please write codes for this also ......
View Replies !
View Related
[CS3] Position An Object At The Right Of The Screen
Hi Guys,
I need to position an object (a movie containing a vector graphic) in my flash movie so that when the browser expands the object always stays to the right of the browser while the rest of the content stays in its current position.
The movie is set to scale so that it takes up 100% width and height.
So basically how do I permanently align an object to the right?
View Replies !
View Related
[CS3] Position An Object Always At The Right Of The Screen
Hi Guys,
I need to position an object (a movie containing a vector graphic) in my flash movie so that when the browser expands the object always stays to the right of the browser while the rest of the content stays in its current position.
The movie is set to scale so that it takes up 100% width and height.
So basically how do I permanently align an object to the right?
View Replies !
View Related
Saving Object Position With PHP
Hey guys, I've got two questions, any help would be greatly appreciated.. firstly about Movie Clips within Flash...
I'm in the middle of making a car racing game (very basic) where the user can edit their own map. The user can drag and drop the finish line and car to any part of the stage before the race starts. It all works untill the end when the user finishes, I want to have a "race this map again" button, but I cant work out how to save the locations of where the finishline and car were dragged in the previous frame. Any answers?
My second question is a bit more advanced and I doubt I'll get it finished in time for my deadline in 2 weeks, anyway, i also want to setup a "save my map and top scores" option that will have to be done with PHP and the same problem applies. The bulk of the map editing is done with a drawing api. I've been told that it is possible to save drawing locations (and there are a few sites that where you can save drawn images) the only thing i wasn't sure of is whether the drawn image would keep its instance name and allow other people to race a map drawn by a different person (the car hittests with the drawn lines you see).
I hope you understand my problem and can point me in the right direction... Thanks in advance,
Chris
View Replies !
View Related
Randomize Object Position?
Okay, here's the deal. I'm trying to figure out how to randomize three objects in a single slide. You know three card monte? Same kind of deal, I've got three different images, one of which is the 'correct' one. I've got it to run perfectly, all I need to do is be able to randomize the order so the user won't automatically know where to click (it's all about deception). I'm guessing there's some way to do it using Arrays, but I have no clue how to go about that.
Anyway, I'd appreciate any help you all can offer.
View Replies !
View Related
Actionscript Object Position Bug
Hello, I'm relatively new to Flash and actionscipt and seam to have stumbled across a bug. When I perform a particular calculation and then set an objects position from the result, the new position is incorrect. I have narrowed down the problem to the following simple actionscript:-
Frame 1 - actionscript
var y = (281.2+29.4);
myObject._y = y;
myText = myObject._y;
stop();
on the Canvas I have a dynamic text object with an instance name of 'myObject' and a var name of 'myText'.
The Problem
The resulting y position is 310.55 and not 310.6 as you would expect, yet the value of y is 310.6. If I change any of the calcualtion values then the objects resulting y postion is correct ie (281.3+29.3) returns 310.6.
What exactly is the problem here? I need to perform this exact calculation and then set an objects y pos to 310.6.
I'm using Flash MX 2004 and publishing as actionscript 2.0. I have also attached the flash doc, if any kind soul has time to look at this.
Any help wold be much appreciated?
Thanks
Dan
View Replies !
View Related
Position Of An Object In A Scene.
Assume I have a crazy hierarchy of objects. Assume i want to compare the positions of two objects in two different hierarchies. Obviously _x wouldn't work as it's position is relative to its parent. Is there an easy way to get this or am i gonna have to loop backwards through all of the parents, and multiply they local position differences by the cosines / sines of the angles respectively to calculate this?
Surely flash stores something's world positions too? right? o.o
View Replies !
View Related
Sound Object: LoadSound: Position
Hi there.
So I've just built a simple audio player in Flash MX for a project. I'm loading external MP3s with the loadSound() method of the Sound object.
Works fine.
I also have a progress bar that displays the percentage of the file that's been played. This works also, except...
...if I click to reload the sound while it is playing, even though it resets to the beginning of the sound, the script is still getting the position property as if the original sound had not been stopped.
Since there is no "unLoadSound()" function, I assumed that subsequent calls to loadSound() would result in the previous sounds getting destroyed.
Anyway, needless to say, this is frustrating me...how can I reset my visual progress bar so that it goes back to the beginning?
(I suppose I could create an entirely new Sound object on each click, but it seems like that would waste memory.)
View Replies !
View Related
Sound Object Position Dumbness
heres the deal.
i have created a sound object and am loading in mp3s into it from a server.
i have an animation that runs while the selected mp3 is loading and it does this by checking to see if either the position of my sound object is undefined or no greater than 0.
this works fine on my comp when i load the mp3s from my comp because when ever a new song is clicked the position property displays it as beginning at 0 which seems like what it should do.
heres the problem.
when i actually stream the mp3s from a server, and run a trace on the position property it does not reset to 0 when a new song is loaded in like on my comp. it just shows the time that the last stopped playing until the new song is loaded in and then it continues from the previous time although the song start at the beginning as usual.
can anyone tell me why this is and if there is a way i can fix it?
View Replies !
View Related
Scaling An Object By Cursor Position
I am trying to modify this tutorial "Rotating Menu" (Interaction - Navigation). This is what I have so far:
Code:
//determines the position of the mouse
x = getProperty("../dragControl", _x);
//checks to see if the mouse is in the movie
if (Number(x)<200||Number(x)>200){
//reduces x so that the change in the menu's size is not too drastic
midX = x-(400/2);
//checks to see if the new variable is a negative number
if (Number(midX)<0) {
//if it is then it changes it to positive
midX = -midX;
}
//change the width and length of the menu
setProperty("../nav", _xscale, midX);
setProperty("../nav", _yscale, midX);
//check to see if the menu's width and height are less than 30 or more than 100
if (Number(getProperty("../nav", _xscale))<30) {
setProperty("../nav", _xscale, "30");
setProperty("../nav", _yscale, "30");
}
if (Number(getProperty("../nav", _xscale))>100) {
setProperty("../nav", _xscale, "100");
setProperty("../nav", _yscale, "100");
}
}
The way it is now, when the mouse moves to the horiz. center, the nav get smaller. I want the opposite to happen.
Any help would be appreciated.
View Replies !
View Related
Make The Object Remain In Its Position
http://www.muevetumusica.com/
When I check out the flash site today, I found that the mobile at the centre will move if I resize the browser. However, the text on the left and the bottom mobile will remain in its position. What does the flash designer does to make this effect? Do anyone have ideas?
View Replies !
View Related
Change Position Value Without Moving Object. HOW?
Hi..
I'ma newbie and was watching a tutorial on creating a scrollbar. In the example he had some content to scroll thru a masked window that would be control by a drag scroll bar.
Just before he began with the scripting those 2 objects, one at a time, in the properties panel.. he did something off screen (sounded like he was hotkeying).. but while he was doing it, he said... "OK, before I start scripting I'm going to 'force' the y value to equal zero for both objects." He said it was easier for scripting.
How did he force the y value to say 0 in the properties and info panel WITHOUT the object changing position on the stage??
thanks,
frank
View Replies !
View Related
Move Object To Position And Stop.
Hiya,
Ok... this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed. I just want it to go up and stay.
Thanks in advance for the help.
Peaceout.
View Replies !
View Related
Odd Trace On Object Stage Position
Hi,
I noticed odd trace that wonder whether someone can explain.
I've got the following code in an ENTER_FRAME event. It's used to move an object.
Code:
_vx +=0.2;
_vy +=0.2;
x+=_vx;
y+=_vy;
trace("_vx: " + _vx);
trace("x: " + x);
trace("----------");
The trace for the first 5 frames looks like this:
Code:
_vx: 0
x: 275
----------
_vx: 0.2
x: 275.2
----------
_vx: 0.4
x: 275.55
----------
_vx: 0.6000000000000001
x: 276.15
----------
_vx: 0.8
x: 276.95
Obviously, 275.2 + 0.4 doesn't equal 275.55.
Does anyone know the reason for this?
Thanks!
Dandylion13
View Replies !
View Related
Move Object To Position And Stop.
Hiya,
Ok... this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed. I just want it to go up and stay.
Thanks in advance for the help.
Peaceout.
View Replies !
View Related
Duration And Position Of Sound Object
Hi, I have a MP3 player which progressively downloads MP3s from my server. I can display the IDtags for song name and track info just fine. But I am having trouble displaying the current time and total time of the current mp3 in my dynamic text fields: 'posTime' and 'songInfo'.
Can anybody help? Thanks, Henrik
ActionScript Code:
function playMusic() {
myMusic = new Sound();
//MP3 Timecode Code:
posMins = Math.floor(myMusic.position/1000/60);
posSecs = Math.round(myMusic.position/1000%60);
//Single Digit Check Code:
if(posSecs<10){
posSecs = "0"+Math.round(myMusic.position/1000%60);
}
//Display MP3 Time to user:
posTime.text = " "+posMins+":"+posSecs+" ";
songInfo.text = ""+posTime+""
myMusic.onSoundComplete = function() {
if (curTrackNum == (myMusicLv.totalTracks) -1) {
curTrackNum = 0;
} else {
curTrackNum++;
}
playMusic();
};
myMusic.onID3 = function() {
trackInfo.text = myMusic.id3.TIT2;
trackCount.text = myMusic.id3.TRCK;
};
myMusic.onLoad = function(success) {
if (!success) {
trackInfo.text = "Failed to load track.";
}
}
myMusic.loadSound("mp3s/mp3-"+curTrackNum+".mp3", true);
View Replies !
View Related
Sliding An Object Based On Mouse X/y Position?
I have an 800 pixel wide stage. There is a sliding strip that moves across it based on the position of the mouse (left/right) and speeds up as you get closer to the edges and slows as the cursor near the middle of the stage. This is all OK. The objects action code for the sliding strip that works it is this ...
onClipEvent(load) {
nScreenWidth = 800;
nMaxRate = 15;
// nPixels determines the speed of the slider movement
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x < -4803) {
this._x = -924;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x > 369) {
this._x = -3510;
}
}
}
onClipEvent(enterFrame) {
// move slider with speed dependent on mouse position
if (_root._xmouse < nScreenWidth/2 && _root._xmouse > 0) {
moveRight(nMaxRate - _root._xmouse * nMaxRate/(nScreenWidth/2));
} else {
if (_root._xmouse > nScreenWidth/2 && _root._xmouse < nScreenWidth) {
moveLeft(_root._xmouse * nMaxRate/(nScreenWidth/2) - nMaxRate);
}
}
}
So far, so good. But what if I want to move the sliding piece when the mouse is only over a certain area of the screen (say, the right 400 pixels) and not the whole 800 pixel wide area.
Can you make an invisible button on the same frame as the sliding piece that is only on the right half of the screen and key the sliders object action to the mouse being over the button's area rather than mouse over the whole screen?
Many many thanks in advance to all ...
David JJ
janikjones@NOSPAMREMOVEsympatico.ca
View Replies !
View Related
X-y Position Of An Object Relative To A Movie Clip
I am using the scroll component in Flash MX.
The document that I show within it is to be scrolled, naturally, by the user.
What I would like to do is to highlight different areas of the document based on an audio script. This means that, the highlight should show up in the same RELATIVE position on the document at any given time.
Is there an easy way to achieve this?
I tried to create the highlight animation within my scrollable document movie clip and it worked: the big disadvantage is that whenever someone pauses my movie, audio will stop but the movie clip and the highlight animation will continue running.
Thanks for the suggestions.
View Replies !
View Related
Animate Moving Object To Fixed Position
in flash 5 i would like to do the following.
a circle is moving around within a fixed area.
as soon as the mouse comes within a certain distance of the
circle the circle should move to a fixed position (say x=50, y=200).
no hassle to make the circle move around. no hassle to detect where
the mouse is in relation to the circle. but how can i make the circle
to take the shortest possible way to its fixed position, taking into
consideration that the circle is moving around. sure you could tell
the circle to take the position of x=50 y=200 as soon as the mouse
comes within a certain distance of the circle, but i actually want to
see the circel move to that position. can anyone lead me to the right track of thinking.
again, i would really like to do this in flash5, but in the unlikely event that this can only be done in flash mx, please let me know.
thanks
hansie
View Replies !
View Related
Object To Move To Mouse Hover Position
Hi,
Hope someone can help. I have a horizontal navigaton bar .
What i woul like is for a mc to slide horizontaly along the line and stop at the position where the mouse is hovering over a button.
Hope it makes sense
Some bounce when it stops will be great to
by the way I'm using flash 5
thanks
View Replies !
View Related
StartDrag() - Object Back To Original Position?
Hey everyone,
Well I have a seemingly simple question here. I have a box , thats right a nice shiney box , and within it contains a smaller blue box which is a movieclip.
Now, when you click this small worthless little box, startDrag(); begins and it follows you around : onClipEvent (mouseDown){
When you release this box, it goes back to its start position , into the centre of the bigger box : onClipEvent(mouseUp){
Thats whats supposed to happen. You click and it follows until you release the mouse and it'll go back to its original position.
Now the problem is this:
After releasing the small box, it goes back to its original position, but continues to follow the mouse from there ... but just from the distance. In other words, startDrag(false); hasnt really worked
Heres the code :
code: onClipEvent (load) {
startX = this._x;
startY = this._y;
}
//
onClipEvent (mouseDown) {
this.startDrag(true);
}
//
onClipEvent (mouseUp) {
this.startDrag(false);
this._x = this.startX;
this._y = this.startY;
}
If anyone could help me out here?
View Replies !
View Related
[F8] Fine-tuning MC Position Using Stage Object
I'm using the stage object to align multiple MC's. My question is how do I affect a MC's position if I want to have it be centered on both axis but 100px away from the bottom margin instead of the top relative to the size of the window?
here's my positioning code:
code:
navBar._y = Stage.height;
navBar._x = Stage.width/2;
tpShadow._x = Stage.width/2;
tpShadow._y = 6;
idol2._y = Stage.height/2;
idol2._x = Stage.width/2;
Also if i'm using an empty MC to load external swf's, do the external swf's have to have AS for positioning as well or do I position the empty MC in the base movie?
Thanks,
Nick
View Replies !
View Related
Position Object Relative To Dynamic Moveclip
[im using this code] >
http://www.actionscript.org/showMovie.php?id=754
I want to place the orange buttons next to the grey container and have them move relevtive to its edge, but NOT resize. I want this to happen in the same way as the text links on this rather nice site >
http://www.nooflat.nu
I have ben trying to modify the various tutorials on how to position objects reletive to the stage but havent got anywhere, your help would be much appreciated as always
thanks
Chris
View Replies !
View Related
How To Display Duration And Position Of Sound Object
Hi, I have a MP3 player which progressively downloads MP3s from my server. I can display the IDtags for song name and track info just fine. But I am having trouble displaying the current time and total time of the current mp3 in my dynamic text fields: 'posTime' and 'songInfo'.
Can anybody help? Thanks, Henrik
function playMusic() {
myMusic = new Sound();
//MP3 Timecode Code:
posMins = Math.floor(myMusic.position/1000/60);
posSecs = Math.round(myMusic.position/1000%60);
//Single Digit Check Code:
if(posSecs<10){
posSecs = "0"+Math.round(myMusic.position/1000%60);
}
//Display MP3 Time to user:
posTime.text = " "+posMins+":"+posSecs+" ";
songInfo.text = ""+posTime+""
myMusic.onSoundComplete = function() {
if (curTrackNum == (myMusicLv.totalTracks) -1) {
curTrackNum = 0;
} else {
curTrackNum++;
}
playMusic();
};
myMusic.onID3 = function() {
trackInfo.text = myMusic.id3.TIT2;
trackCount.text = myMusic.id3.TRCK;
};
myMusic.onLoad = function(success) {
if (!success) {
trackInfo.text = "Failed to load track.";
}
}
myMusic.loadSound("mp3s/mp3-"+curTrackNum+".mp3", true);
View Replies !
View Related
Blurring An Object In Respect To Depth/position
Hello,
I was in search of something to eat this afternoon and came across taco bell's site.. nutritious person that I am..
http://www.tacobell.com/
And I was curious as to how they achieved the blurring of the images as they receded into the background. I've tried this before using a sharp and a blurred image, but couldn't get it as smooth as this site. Anyone know how this was achieved? Would it take a lot of CPU resource?
View Replies !
View Related
How Can I Find Out The Position Of A Math.random Object?
HI
How can I find out the position of a Math.random() object that just dropped down the stage?
The movieClips drop down the stage randomly, but sometimes, they are to close to each other. I want to find out the "old"-position of the last object that dropped to the stage and than set the "new"-position +20.
I couldn't find a solution so far and hope you could help me tonight...?
This is what I've got so far:
ActionScript Code:
var ufo_timer:Timer = new Timer(4000);
ufo_timer.addEventListener(TimerEvent.TIMER, addUfo);
var ufo01_mc:Ufo01;
var position:Number;
var maxLimit:uint = 50;
var minLimit:uint = 750;
var range = maxLimit - minLimit;
function addUfo(e:TimerEvent){
ufo01_mc = new Ufo01();
addChild(ufo01_mc);
//trace(Math.random());
position = Math.ceil(Math.random() * range) + minLimit;
[b]//if(old position, set new +20)[/b]
ufo01_mc.x = position;
ufo01_mc.y = 10;
ufo01_mc.addEventListener(Event.ENTER_FRAME, moveUfo);
}
View Replies !
View Related
How To Trigger A Function Dependig On An Object Position?
Hello,
Is it possible to trigger a function, just at the moment an object reaches some position or another property value?
I am trying this:
Code:
onEnterFrame = function () {
if (myObj_mc._x == 100) {
runMyFunction();
delete(onEnterFrame);
}
}
this checks the position of my myObj_mc every frame, but when I use a lot of clips with onEnterFrame and a condition it slows down the performace. Is there some smarter way to do the same?
Thanx
View Replies !
View Related
Scaling An Object Porportionately To Its Y Position Trouble
I've got a slight problem with a flash file I’m doing for a neighbour... She wants different draggable objects on the screen... That is fine, but she also wants them to scale themselves too. I've got the scaling working by calling this function inside every inside every onPress.
Code:
function scalePicture() {
this._yscale=Math.round(this._y/5);
this._xscale=Math.round(this._y/5);
}
This does almost what i want except it doesn’t keep an objects proportion in comparison to another object. If I have one movieClip at 150 px in width and another at 50px in width they both end up the same size when at the same height.
I understand as much that I need to somehow tell the scalePicture funtion that this objct is slightly bigger but cant figure out how. Any hints would be greatly appretiated.
Dave
View Replies !
View Related
Fine Tuning MC Position Using Stage Object
I'm using the stage object to align multiple MC's. My question is how do I affect a MC's position if I want to have it be centered on both axis but 100px away from the bottom margin instead of the top relative to the size of the window?
here's my positioning code:
ActionScript Code:
navBar._y = Stage.height; navBar._x = Stage.width/2; tpShadow._x = Stage.width/2; tpShadow._y = 6; idol2._y = Stage.height/2; idol2._x = Stage.width/2;
Also if i'm using an empty MC to load external swf's, do the external swf's have to have AS for positioning as well or do I position the empty MC in the base movie?
Thanks,
Nico
View Replies !
View Related
Moving Object: Return To Base Position First
Hello,
I have the following problem: i want to move an object (graphic/movieclip/whatever) to different positions by the use of several buttons. The problem is however that I dont know how to do this..hehe..is there some code to let the object first return to the start position, and after this to the position it is assigned to? Or is it also possible that, through actionscript, the object directly "tweens" towards the designated position?
Hope someone can help me with this.
View Replies !
View Related
Object Position On Stage - Need Action Script
Ive got a bit of a problem with playing several movies in the same place. Ive made a menue in which when you click one of the buttons a movie clip plays and eventually stops at the point of which that part of the menue screen is fully loaded.
The problem is that each one loads on the same area of the stage. Each movie begins with the alpha sety to 0. When i load one of the movie clips, i want it to stay on screen uptill the next one is selected. However, if the next one which is selected was placed on the stage first when i designed the interface, the movie cannot be seen as it is behind the first movie.
What action script can i use to make the the movie clip load up at the front of the stage.
I thought it would be tell target command, but i wasnt sure what the exact code would be.
I also thought that some sort of if, then, else statement could be used to unload the movieclip. I have no knowledge of action scripting so i am not even sure that this type of statement is used in the language.
I would be thankful of any help anyone could give me
David
View Replies !
View Related
Object Position Logic Assist Needed...
Hello,
I need help with a function I'm trying to build.
As many who've read my posts recently know, I've built a text editor for on-line newsletter purposes for my company. The current problem revolves around placement of different objects onto the stage.
I have it set up so that the user can choose to place either a TextArea or a ImageArea on the stage to hold their text/images. They may place these objects anywhere they want, but the program is not SUPPOSED to allow overlapping. And if/when two objects overlap, the object needs to be moved to a free area(an area with clear space i.e. no other objects).
I know about hittest, and I can't use it because it only tells you that the objects are intersecting, not where or why.
I already have part of the function so that the objects are confined to the boundaries of the page, so what I need help with is the design of the section where the program decides if something is invalid and which way it is to be moved.
I will post the function below. It mostly works atm, but I'm thinking I may need to make it recursive or something to catch for the objects on the page that the function is not currently checking against.
For example, When I start placing items on the page. The first thing I'll place is a textarea that's 2" x 2". This is all within a 8.5" x 11" page area. The second thing I'll place is an image that's also 2" x 2". This item is placed to the right of the previous item.
I'll keep this up until I hit the right side of the page. At that point, the program should try to start placing items below the items taking up the top line and starting at the left working right. Instead, it again pushes the items to the right of each object at the top because it's only checking against ONE object at a time. When the checking function gets to the right margin, it moves down until it hits the bottom margin. After that the program breaks as it can't figure out where else to go.
If anyone can help me with this I'd appreciate it graetly!
Apparently, I'll need to post this in two seperate posts. The function is here:
Function for other post
Notes:
the variable getout and cooresponding if statement was based off a previous version of this function, I don't beleive it ever equals anything but 0 in this version.
The Clone object is the new object being placed. It's values are checked against the Boundarray objects that already exist.
The Boundarray object array:
The first element is the object that stores the page margins. That is why it is used in a different fashion than the rest of the elements in the array.
I only found getBounds after I had done most of this, so I decided to stick with what I'm using instead of trying to do a full re-write just for that.
If you have any questions please ask, I realize that this is rather complicated and I may have missed some things in my explination.
thanks.
View Replies !
View Related
Object To Mouse Position - Smooth Movement Problemo
Hi all, I've got a ruler type line where the central point of the line follows the mouse on the x co-ordinates and scrolls left or right depending on where it is.
I've accomplished this using a MC which contains the following code and works spot on. But what do I need to do so that the central point adjusts with tweening so it doesn't follow at the same pace, like when you set the easing to 100 using tweening?
Thanks in advance. Here's the code I've used so far.
:::::::::::::::::::::::::::::::::::::::::::::::::: :
Frame 1 of MC
:::::::::::::
if (_root._xmouse>_level0.calib._x) {
_level0.calib._x = (_level0.calib._x+1);
} else {
_level0.calib._x = (_level0.calib._x-1);
}
:::::::::::::
Frame 2 of MC
:::::::::::::
if (_root._xmouse>_level0.calib._x) {
_level0.calib._x = (_level0.calib._x+1);
} else {
_level0.calib._x = (_level0.calib._x-1);
}
gotoAndPlay (1);
View Replies !
View Related
Object Movement Relative To Mouse Position -origin
Hi there, im totally noob at this so please bear with me...
ive looked on the forums and several other ones for solutions but found nothing.
I have this script applied to a MC which will move relative to mouse position. It works fine and also includes easing... BUT how do i set the x/y co-ords for the point of origin??? (ie. when mouse position = object position)
The only way i could change the origin was by changing the dimensions of the object (the movie clip) which is not practical.
The following code is applied to a MC
Code:
onClipEvent (enterFrame) {
//this controls the speed of easing
speed = 5;
//this code calculates the object movement...
//relative to mouse postion
endX = -_root._xmouse;
endY = -_root._ymouse;
//This calculates the ease
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}
The .fla & .swf are here
i think im missing something but i just wudnt have a clue.
And is anyone able to please explain the "+" in the code "_x +=" and "_y +=" its on the last two lines. I have no idea wat the "+" means/does to those equations.
Any help appreciated.
thanks guys.
View Replies !
View Related
Object Position Effect The Panning Of Attached Sound
hey guys from one of the tutorials found on action script or flaskit i have started to create and adapt my own thing...... for now i have used the sound files from the tutorial... but they will change once i have them......
right then....... urm!lol
i have made it so that the volume of the sound attached to each duplicate movie clip is contolled by its possition on -y. i have also tried to make each MC do the same but for the panning control, with its left right possition...... but somethings gone wrong......
i have tried to addapt several tutorials to try and complete this task......
each Mc has to be started from the current position other wise all the location points will be out, after working this problem out i want to experiment with putting behaviours on each block so that they can be thrwn accross the stage and bounce and colide with oneanother... with all this i think that the sounds produced could be cool and interesting, with a variation on user and computer control....... hmmmm what do you think????
ok just zipped my file and it was 26.1mb from 32.....so i shal type the code i have used.actually its not letting me attach anything....*cries
too confusing so i took some screen shots...... this will confuse everyone........
no worries if no one replies cos it weell past my bed time aand have not done this very welll
View Replies !
View Related
|