hardish flash question
- Started
- Last post
- 13 Responses
- tonks
Hello,
I have a bar chart. Lets say the first bar is called 'bar1mc'. I want to fix another movieclip called 'percent' to whatever the height of the bar is... So its y position is always level to the top of 'bar1mc'. Understand?? Can anyone help me out with a bit of code I can just dump on the movie clip 'percent'. OnClipEvent or something... Hope I havnt made it sound to complicated. Cheers...
- ********0
right bear with me, I haven't written a line of AS in months....
Anyway I am assuming that all bars have the same baseline.....right?
so let's say
baseline._y = 300;then all you have to do is to say clipToAttach._y = heightOfBar + Baseline + AnyOffsetYouWant
That didn't make me hard though, not even hardish.... sorry.
- tonks0
ah yes but the height of the bar is going to depend on some user input so it will change. So It needs to re-adjust it y position depending on some user input. Sorry my actionscript isnt great so I appreciate your help... Maybe its a little hardish now?
- ********0
nope still not hard.
the user can input different values for each of the bars??
then you have to have some trigger to update the size of the bar.... use this same trigger to set the ._y value of the clip you want to attach.
- fate0
so just trigger it after the user changes something... or make it constantly look for updates with onEnterFrame or something.
secondBar._y=firstBar._height+fi...
add _root. as necessary.
for constantly checking:
onClipEvent (load) {
this.onEnterFrame=function(){
secondBar._y=firstBar._height+fi...
}
}
- fate0
I'm really getting annoyed by the random spaces NT jacks up your posts with...
The constantly checking code belongs on an MC. There are other ways to do it, better ones where after the user changes a value, then it'd be compared to an original value...then it does the shit.
- ********0
the constantly check will not work if you are using (onLoad) also bad syntax my man.
use myMovie_mc.onLoad instead.
But anyway it would be an onEnterFrame to constantly check or indeed a setInterval.
Neither of these are needed though because it only has to change when the user defines the new size - so use an onRelease on the "change bar height button"
Concerning how AS gets fucked up when posted ehre I agree entirely.
- tonks0
great thanks guys... I get it. Bit rusty u know...
I dont understand you comment above though?
- tonks0
oh yeah i do.. weird spaces..
- ********0
tonks what don't you understand?
- fate0
The syntax is straight outta flash, no problems with it ;)
But you're right, i need to get used to writing actions on the frames with more objects instead of the old-skool way.
- ********0
aye laddie straight ootta flash 5,,,,,
- System-Idle0
here is your thread!
it went of screen due to no more posts.
to view recent threads scroll down and click Prev!
this._y = (_parent.bar1._y -_parent.bar1._height);
- tonks0
your a star - thankyou.