PDA

View Full Version : Force y value to equal 0, without moving object


frankdaria
06-01-2007, 10:04 PM
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

evride
06-02-2007, 12:32 AM
idk quite what u mean. but in the properites panel its nice to keep graphics at zero inside movie clips. that way in actionscript if u move an objcetu dont have to do math to compromise for the graphics position inside the movieclip.

he could have moved an object using actionscript that u thought was the properties panel. it would look like this
mcInstanceName._y = 0;
actionscript does not move an object right away tho it moves it when u watch the swf

frankdaria
06-02-2007, 05:03 AM
HMMMM.....


I really appreciate your reply.. There must be something I'm missing somewhere. Today I finally got my sroll bar to work but I had to do the math.. IT SUCKED! The ._y position equation that control the graphic (text1) bar the scroll bar (bar1), which is a drag bar, btw, ended being this:


text1._y =(-4/3* bar1._y)+265;

the top of the drag was at 108, and it was 85 pixels high, the text1 top was at 128 and it was 268 pixels long. It was trial and error for a long time there..


BUT in the tutorial.. after he did all the 'forced' zero thing.. his equation was this:

text1._y = -5* bar1._y

And I KNOW the y values for his bar and graphic were at similiar distances to mine from the origin.. If you're interested and have a few minutes look at this .fla file... here (http://www.time-lineproductions.com/flash/end_of_part1_v6.fla)
Click into the srollbox mc and look at the y position values for the bar and that text graphic.. I can't find any action script in it that indicates a change...

thanks again
frank

orange gold
06-03-2007, 12:16 AM
i used to know a code it was like set (objects name here) _y value to 0...*** or***... new_y = 0

orange gold
06-03-2007, 12:20 AM
this is a simple one, make a box, call it button put it on frame one and have no other frames " you can edit" then add this code to frame 1 ...
...
button.onPress = function() {
this._x = 0
this._y = 0
}

orange gold
06-03-2007, 12:32 AM
if your talking about the cartoonsmart.com tutorial then he made it an object and went inside of it which makes the 0,0 inside the object the upper right corner of the object then he just moved the crosee that appears inside the object to the middle of the object so that that is the new global xy position inside that object

frankdaria
06-06-2007, 12:04 AM
if your talking about the cartoonsmart.com tutorial then he made it an object and went inside of it which makes the 0,0 inside the object the upper right corner of the object then he just moved the crosee that appears inside the object to the middle of the object so that that is the new global xy position inside that object

:) Thats EXACTLY what i was talking about THANKS a lot BRO!!!!!!!

Owe you one!!:
:)