Tracking An Objects Y Position?
Jan 23, 2010I did have previous help with screen movement from Vincent, unfortunately how to get a Variable that tracks an objects Y position on movemnt is eluding me
View 7 RepliesI did have previous help with screen movement from Vincent, unfortunately how to get a Variable that tracks an objects Y position on movemnt is eluding me
View 7 RepliesSo I've got a button that spawns a block and when pressed spawns another to the right of that block, if pressed again the process repeats. These blocks are all placed into an Array. When the user click on the blocks, they are removed.I would like the blocks to track their position in the Array so I can splice out the value on click and all the other "building spots" will move to their Array position * building spot width, so when a block is cut out, the others all move a long and remove that space.Since Arrays aren't my strong point, I wish to see what you think would be the best option here. Now keep in mind I am not a Flash Pro, so the way I have coded may not be the best, but I like to think I try Here is the code currently:
ActionScript Code:
onClipEvent(load){
}
[code]......
How to track the no. of balls inside my movieclip (ball7)? And put as dynamic text (winner_txt)?
Inside my movieclip has no layer, ball layer.
No layer: each individual one frame is labelled "0b", "1b" and continues..
Ball layer: first frame empty, 2nd frame 1 ball, 3rd frame 2 ball.. and continues..
Tried using:
var no = _root.ball7_mc._currentframe
_root.winner_txt = Number(no);
I've got two rather large arrays which I put a bunch of movieclips into and I'm just stumped on how I can possibly track if a specific movieclip in the array is right or wrong. Determing right/wrong is something I need to be able to set and then check again later when a function getItem is called.
Code: Select allvar mcArray:Array = new Array();
mcArray = [movieClip01, movieClip02, movieClip03];
button.addEventListener(MouseEvent.CLICK, getItem);
[code]...
I've got two rather large arrays which I put a bunch of movieclips into and I'm just stumped on how I can possibly track if a specific movieclip in the array is right or wrong. Determing right/wrong is something I need to be able to set and then check again later when a function getItem is called.
I just quickly made this example code because the actual file's code is much longer and contains a bunch of other code that is irrelevant to this issue.
Code: Select allvar mcArray:Array = new Array();
mcArray = [movieClip01, movieClip02, movieClip03];
button.addEventListener(MouseEvent.CLICK, getItem);
function getItem(e:MouseEvent):void {
[Code].....
What's the correct way to track mouse position, from Adobe Flash, when someone has: Started a drag within the Flash application (a MOUSE_DOWN event), Dragged the mouse outside the app or even the browser window (a MOUSE_MOVE event), and Released the mouse button (a MOUSE_UP event)? For example (imagine Stack Overflow is a Flash application):
Within the app, I'm able to track the mouse X and Y positions with a MOUSE_MOVE event listener, but I lose it when it goes outside of the browser... So, how do I track the position of the mouse no matter where it goes? For a good example, try Google Finance. Try dragging the chart around; it'll still drag around if you move your mouse out of the browser window, and the mouse will be outside of the browser when you release it.
Also, check out KOKO KAKA; If you click on the scrollbar (make the browser window really small) and move outside of the browser window, the scroll bar moves just like a real one would. I believe both only work because the MOUSE_DOWN event "captures" the mouse, allowing the Flash application to track the position of the mouse even when it is outside of the browser.
I have 4 objects that I all want to have their own velocities. I have a bunch of variables (each one has a different value):
PHP Code:
public var vx1:Number;public var vx2:Number;public var vx3:Number;public var vx4:Number;
Rather than having a function for each object to say:
PHP Code:
function1 { this.x = vx1}function2 { this.x = vx2}function3 { this.x = vx3}function4 { this.x = vx4}
I'd like to have a for loop to have my objects x position to += vx(1 through 4):
PHP Code:
for (var i:Number=0; i<5; i++) {
this.x += (vx+[i]);
}
So I tried the above with a combination of " " around different parts of (vx+[i]) but I realized that turning any of it into a string means 'this.x' cannot read it because x has to be a number not a string. So how can I make this.x = vx1 then vx2 and so on with a for loop?
The buttons are all set up in Action Script and not placed on the timeline at all.Here is the code for postion on the buttons.I do not want to move the buttons by PixelsI would like to move the buttons by Perectage so it will look the same on all computer monitors.The person that I am editing the file for would like them in the bottom left of the screen.Here I have moved them by Pixels but these buttons do not appear in the same place on all monitors.
///////let's set the position of
the buttons across the bottom of the screen
b1.move(-350,150);
[code]......
A Flex project exported as a Projector, showing fullscreen. The project has a background and several dots which each represent a "Location". These locations are fetched from an XML file and have their position set in percentages. The location in pixels is calculated (this works as it should) by the width and height of the Application. The dots are placed correctly. The background is a JPG with a resolution of 1280*1024. At this moment, the background is set on a Canvas with backgroundSize = auto. This places the image in the center without stretching it. Stretching results in ugly, pixelated images and tears the proportions apart.
Problem When we view the project on 2 different resolutions (1 = 1280*1024; 2 = 1024*768), the dots are in the good position, the background image is sharp. But - because of the background having the same resolution as 1, the background isn't fully shown in resolution 2 (because it isn't stretched. A logic result. That's why I tried stretching the background. The results:
[Code]...
I know how to ease objects from one position to another etc, but how do you make it ease position as well as transparency? so it fades in while moving to it's new position?
Code:
var WelTween:Tween = new Tween(welcome, "x", Strong.easeOut, CurMarkXPosWel, 277, 2, true)
is there a way to add like 0% opacity to 100% opacity in the same line of code or do you do seperate?
how do you position objects in browser using flash?
View 10 RepliesIs it possible to place object on stage with positions read from a CSS file?Basically what I want is to create themes for the application. As and when a different theme is selected, xy position, skins and colors of objects should get applied accordingly.How far its practical? If this is not practical could any one suggest a better way of applying theme
View 1 RepliesI have a script where i need an objects X and Y Position to change when you enter a certain frame.
On layer 1 i have an input text field with the instance of "message_txt" that runs along all 5 frames in the timeline.
On layer 2 i have 5 frames each with its own actionscript on. The user navigates between frames with simple 'gotoAndStop(4)' etc... on each next or back button.[code]...
I have several objects, moveclip, graphics and shapes in several layers keys and want to change position, for example, a moveclip is in the position X: 218 Y:45 and so in other key layers,To change it to X: 240 Y: 50, I go to keyframe for keyframe touch the object and go to properties and change one by one is annoying.Is there any way to do this more quickly at one time in all key frames?
View 1 RepliesI am trying to do adjustment of position (x and y) of display objects, relative to other display objects. In other words: I have two Sprite objects (rectangle and circle). The rectangle can have their width changed during execution. Yet the circle has a fixed size. What I do is this: regardless of the width of the rectangle, the circle is positioned at the far right of this rectangle.
I tried as follows:
ActionScript Code:
rectangle.width = someValue;
circle.x = rectangle.x + (rectangle.width-circle.width);
In theory it should work, but look what happens:
imageshack.us/photo/my-images/837/positionq.png
As the width of the rectangle increases the distance from the desired location also increases.
Using:
ActionScript Code:
trace (rectangle.width);
I realized that the value of property 'width' does not match the exact amount of pixels that the object is wide. I just did a test and realized that this problem only happens when the rectangle has edge. When the rectangle has only fill, this problem does not occur.
I'm trying to create 49 total objects, each 50x50 px. And position them in 7 rows and 7 columns. I think I must use nested for loops but this is all Ive come up with.
[AS]for(i=1;i<=7;i++) {
for(i2=1;i2<=7;i2++) {
duplicateMovieClip(_root.tMain,"targ"+i+i2,i+i2);
[Code]....
Right now I'm working on a website that has movie clips that I want to tween back and forth across the stage when a button is pressed.
Here's the idea:
When 2_btn is pressed, I want 1_mc, 2_mc, and 3_mc to move from right to left and then stop when 2_mc is positioned on the stage, stop moving and play
Then if 3_btn is pressed I want all three to be animated from right to left until 3_mc is positioned on the stage, stop moving and play
Then if 1_btn is pressed I want all three to move from right to left until 1_mc is positioned on the stage, then stop moving and play
Basically I have no idea how to accomplish this, or how to word it into Google.
What I have right now, which obviously isn't accomplishing what I want is:
Tween from left to right across the timeline, and then using a gotoAndPlay, and then stop(); on the frame..
I have a flash script which creates instances of movie clips and stores them in an array. What I want the script to perform next, is when clicking a "save" button the position and the movieclip class name of each created instance will be sent to an external script to store.
View 6 Replieshere's my code:
ActionScript Code:
for (var i:int = 1; i < 10; i++) {
var symbols = new targetTester();
[code]......
I've been trying to sort objects depths based on their Y position but have not been able to do it efficiently. I was able to successfully sort objects with a selection sort algorithm and a quick sort algorithm; however, both have only been partly successful. Selection sort gets about 8-10/30 FPS with 13 objects and gets about 14-18/30 FPS. This is not good enough as I figure I could have as many as a hundred objects to be sorted at once.
After digging around, I found that array.sort() is more efficient than a quick sort implemented in AS3 and that calling swapChildren() or swapChildrenAt() at every swap was bogging it down. So now I am copying the objects array and sorting it with sort() and then comparing the two and swapping displayObjects so as only to call the swapChildren() or swapChildrenAt() method once per element. It appears to be running, and at full speed, though it won't swap correctly. Here is my code:
[Code]...
I want the diameter of the 'balls' orbit to change dependant on the position of the mouse but keep the point of rotation exactly the middle of the stage at all times.I.e. if the mouse is hovering over the exact center (both X+Y) of the stage then the 'ball' should have a tiny diameter of rotation (but contstantly follows the orbit in clockwise direction) whilst if you move the mouse towards the edge of the stage then the diameter of the orbit of the ball will increase.Here is the AS which controls a blank movieclip;
var sp:Sprite = new Sprite();
orb1.addChild(sp)
var g: Graphics =sp.graphics
[code]....
This is for a personal art project, however I have hit a potential (Actionscript) brick wall! I want the diameter of the 'balls' orbit to change dependant on the position of the mouse but keep the point of rotation exactly the middle of the stage at all times. I.e. if the mouse is hovering over the exact center (both X+Y) of the stage then the 'ball' should have a tiny diameter of rotation (but contstantly follows the orbit in clockwise direction) whilst if you move the mouse towards the edge of the stage then the diameter of the orbit of the ball will increase. Here is the AS which controls a blank movieclip;
[Code]...
I have a logo made of 28 circles which I need to animate using flash cs3...so far I have made the logo randomly animate using this There are two things I need to achieve...the circles on the stage start from the position they lay on the stagereturn back to those positions after say 45 seconds...
View 2 RepliesIf you wanted to create a client-side Flash-based sound editor that lets you load more than 1 sound to an interface that allows you to manipulate the individual positions of the sounds, and mix/play them in real time, how would you accomplish this?
I'm looking to create a simple version that can mix 2 mp3s, allowing the user to adjust the positions of each. Sort of a dumbed down version of Aviary's Myna audio editor.
At the end of the mixing, I would also like our server to mix the 2 mp3 files with the proper positioning into 1 mp3 file...
I've put together this simple code for an SWF with three roll over images (called: Training, Resources and Contact).When I roll over Training I would like the symbol Training_txt to tween its alpha to 1 (from 0) and tween its y axis to 220 (from 83).When I roll out of Training I would like to run the two tweens in reverse.
This works fine for each of the three roll over images, so long as each tween is allowed to fully execute before a new tween is started. The problem arises if i quickly move the mouse curser between the three roll over images before the previous tweens have finished executing.In this instance, the tweened objects start to behave erratically. They usually return to their original position as per the roll_out tween but then start jumping between y axis 200 and y axis 83 (without tweening - they just appear).
Code below -
stop();
import fl.transitions.Tween;
import fl.transitions.easing.*;[code]..........
is there a way to have (the postion of) objects be dependant of another one? I have attached a simple .fla file with two boxes (MovieClips) that grow in height. Since the position of the bottom box is constant, the top box soon expands "into" the one below so that parts of it are hidden. What I want is that the gap between those two objects stays constant (in this case 50px). So, is there any way to make the position of one object dependant on (the size of) another? Or is there any other "workaround"/tip you can give me?
View 18 Repliesdoes flash have a way of tracking down every where that an mc is being used?
in my library I have an mc that says it is being used 3 times ... but I can only find two of them ... the mc has a sound in it that i need to get rid of.
Got a question from a fellow designer about the use of Tracking Pixels in Flash. Does anyone use tracking pixels in their Flash creatives? If so, how/where do you embed them?
View 2 Repliesim doing a FlashLite 2.1, now have following code.
stop();fscommand2 ("SetSoftKeys", "", "Quit Game");
Key.removeListener (myListener);
var myListener:Object = new Object ();myListener.onKeyDown = function (){ var keyCode = Key.getCode (); if (keyCode ==
[code]....
but i cant be doing this for all 12 movieclips so have source for help and did this:
var bowlList:Array = [ball1,ball2,ball3,ball4,ball5,ball6,ball7, ball8,ball9,ball10,ball11,ball12];function movestones(bowlIndex) { var numStones = bowlList[bowlIndex]._currentframe-1; for (;numStones>0;numStones--) { //place stone }}s_1.onPress = function(){ movestones(0); }
Trying to create a banner ad as a one-off project for a client. I am using Flash Builder / AS 3 and with my simple hello world example. Google Adwords rejects the add with: Encountered flash error - ad cannot use mouse tracking.
I Have not been able to figure out what I am doing that signals to Adwords that I am mouse tracking. Follows is my simple mxml file: (the handleClick is to adhear to their clickTAG specification)[code]...