|
-
[F8] Please help I am baffled by actionscript
Hi all,
You may have read my other post in the Flash 8 section about the menu system with 3 bubbles - this is linked with that same bit of work i'm working on at the mo. I will explain - and i appreciate any help I can get right now as I am officially out of ideas other than to do my work a totally different way!
I have 3 bubbles - menu items. Each one enlarges in size when you roll over it, and when you do so, the other two reduce in size and their alpha changes to 50%. When you roll out, the bubbles all return to normal size. This is fine, but because of the way it is scripted, if you move through the bubbles in sequence (top one, then the next one, then the next) it doesnt look right because it is doing what i have scripted it to do - resize to normal when you roll out and reduce to smaller size when you roll over the next bubble. I hope that makes sense! So basically it's doing what it is being told to do - when you dont mouse over in sequence! In other words there is a flaw in the code in this situation.
Example: (i hope this makes things clearer)
When you mouse over bubble 1, it increases in size, bubbles 2 and 3 become smaller. You then mouse over directly to bubble 2, which increases to a bigger size (not normal size), bubble 1 reduces, bubble 3 gets bigger and smaller again!
I have tried to find a way of setting conditions so that the bubbles understand when they should resize and when they should stay small, but I have had no luck, I am so confused.
Here is my entire code, which is on an actions layer in the movie clip called bubbles_movie, which contains the 3 bubbles and their invisible buttons (ends with _inv). The commented IF statements are what i tried to use as a solution. The bubbles are movie clips which are all animated individually to start normal, get bigger, resize, get smaller and resize to normal again, and there are stop actions on these frames (these are the frame numbers i refer to in the script).
Code:
stop();
download_inv.onRollOver = function() {
_root.bubbles_movie.download_btn.gotoAndPlay(2);
_root.bubbles_movie.register_btn.gotoAndPlay(16);
_root.bubbles_movie.login_btn.gotoAndPlay(16);
download_btn.swapDepths(1);
register_btn.swapDepths(0);
login_btn.swapDepths(0);
trace("download rollover")
}
download_inv.onRollOut = function() {
_root.bubbles_movie.download_btn.gotoAndPlay(9);
_root.bubbles_movie.register_btn.gotoAndPlay(23);
_root.bubbles_movie.login_btn.gotoAndPlay(23);
download_btn.swapDepths(0);
trace("download rollout")
/*if (_root.bubbles_movie.register_btn._currentFrame==22) {
_root.bubbles_movie.login_btn.stop();
trace("login is still small")
}*/
}
register_inv.onRollOver = function() {
_root.bubbles_movie.register_btn.gotoAndPlay(2);
_root.bubbles_movie.download_btn.gotoAndPlay(16);
_root.bubbles_movie.login_btn.gotoAndPlay(16);
register_btn.swapDepths(1);
login_btn.swapDepths(0);
download_btn.swapDepths(0);
trace("register rollover")
}
register_inv.onRollOut = function() {
_root.bubbles_movie.register_btn.gotoAndPlay(9);
_root.bubbles_movie.download_btn.gotoAndPlay(23);
_root.bubbles_movie.login_btn.gotoAndPlay(23);
trace("register rollout")
}
login_inv.onRollOver = function() {
_root.bubbles_movie.login_btn.gotoAndPlay(2);
_root.bubbles_movie.download_btn.gotoAndPlay(16);
_root.bubbles_movie.register_btn.gotoAndPlay(16);
login_btn.swapDepths(1);
register_btn.swapDepths(0);
trace("login rollover")
}
login_inv.onRollOut = function() {
_root.bubbles_movie.login_btn.gotoAndPlay(9);
_root.bubbles_movie.download_btn.gotoAndPlay(23);
_root.bubbles_movie.register_btn.gotoAndPlay(23);
trace("login rollout")
}
I'm sorry that I cant upload any example files etc so i understand if this is all a bit confusing. I think I am on the right lines but I cant quite work it out. I hope there is a solution for it. I know that the bubbles need to do the following (using one case as an example):
if (moving mouse from download button to register button) {
login button must not change size
}
I hope someone can help as I am so stuck!
Thanks in advance
Theo
-
not sure if this is any good, but it scales on roll over and back on roll out:
just a quick program /script
Code:
attachMovie("circleBtn", "circleBtnOne", this.getNextHighestDepth());
attachMovie("circleBtn", "circleBtnTwo", this.getNextHighestDepth());
attachMovie("circleBtn", "circleBtnThree", this.getNextHighestDepth());
circleBtnOne._x=300;
circleBtnOne._y=200;
circleBtnTwo._x=300;
circleBtnTwo._y=300;
circleBtnThree._x=300;
circleBtnThree._y=400;
circleBtnOne.onRollOver = function(){
trace("Rolled over button One");
circleBtnThree._xscale=140;
circleBtnThree._yscale=140;
circleBtnTwo._xscale=140;
circleBtnTwo._yscale=140;
}
circleBtnOne.onRollOut = function(){
trace("Rolled over button One");
circleBtnThree._xscale=100;
circleBtnThree._yscale=100;
circleBtnTwo._xscale=100;
circleBtnTwo._yscale=100;
}
circleBtnTwo.onRollOver = function(){
trace("Rolled over button One");
circleBtnOne._xscale=140;
circleBtnOne._yscale=140;
circleBtnThree._xscale=140;
circleBtnThree._yscale=140;
}
circleBtnTwo.onRollOut = function(){
circleBtnOne._xscale=100;
circleBtnOne._yscale=100;
circleBtnThree._xscale=100;
circleBtnThree._yscale=100;
}
circleBtnThree.onRollOver = function(){
trace("Rolled over button One");
circleBtnOne._xscale=140;
circleBtnOne._yscale=140;
circleBtnTwo._xscale=140;
circleBtnTwo._yscale=140;
}
circleBtnThree.onRollOut = function(){
trace("Rolled over button One");
circleBtnOne._xscale=100;
circleBtnOne._yscale=100;
circleBtnTwo._xscale=100;
circleBtnTwo._yscale=100;
}
simply add the alpha code in each button, circleBtnOne._alpha=50; on over the =100 on roll out
si
NOW! look whats happened! I told you to watch this space and now its gone. 
-
Maybe try something like this...
Last edited by dawsonk; 08-22-2007 at 10:51 AM.
-
thanks to both of you for your help. Si, could you please explain the first few lines (attachMovie)? I've never really understood it properly.
Thanks
Theo
-
not a problem:
attachMovie("circleBtn", "circleBtnOne", this.getNextHighestDepth());
what this is doing is taking a MC/Btn/Graphic within the library called "circleBtn" and attaching it to the movie dynamically. It the uses the second quoted mark to give it a new name "circleBtnOne" and then defining a depth level to place it but by putting "this.getNextHighestDepth()" it finds the latest Depth level available as if you have loads it can be hard to keep track etc
there are a few things you need to do to the original library object before this will work, mainly right click on it and select linkage in the options tick "Export for Actionscript and the name of the identifier will usually come up with the same name etc but you can always alter this but make sure its the first name used in the attachMovie("circleBtn",... ie"circleBtn"
hope this helps a little let me know if you need more info
si
NOW! look whats happened! I told you to watch this space and now its gone. 
-
i see. I think I get that. Havent tried your example code - will do 2moro at work i think - but does it scale gradually or is it an "instant" scale from one size to another? Cos i'm looking for a gradual scaling motion
-
the one i gave is a direct scale the Eg that dawsonk gave is a graduated one, but the one I gave could be changed into a gradual one as well with a little code manipulation ect just keep us posted etc could alway semail the eg one to you if wanted?
NOW! look whats happened! I told you to watch this space and now its gone. 
-
i have downloaded dawsonk's one to have a quick look, i think its pretty much what i want but i cant see a way of controlling the speed of the scale animation? Will i be able to do that with your example once it is changed a bit, Si?
-
not sure if you noticed but if you double click on the btns then you find the tweening animation in there so you can control it here or not but not sure what you mean by control etc otherwise if you use AS for the increase then I cannot see why Not either on mine
NOW! look whats happened! I told you to watch this space and now its gone. 
-
yeah i noticed that. I think i understand the basics of that code. What i meant by controlling the speed of the scaling was making it scale up or down quicker or slower than it does already.
It still has the same problem i had though, where the circle you are not rolling over changes size and back again when you go from one circle to another - its only a slight movement but its still happening - maybe its one of those physical impossibilities that you just cant get around lol
-
 Originally Posted by spaghbol
yeah i noticed that. I think i understand the basics of that code. What i meant by controlling the speed of the scaling was making it scale up or down quicker or slower than it does already.
what you need to do in this case is reduce the frames click in the middle of frames 9 and 18 and say delete 4 frames, this will speed up the scalling, the same goes for the first couple of frames 2 to 8. If you want it to go slower just add a few frames etc
 Originally Posted by spaghbol
It still has the same problem i had though, where the circle you are not rolling over changes size and back again when you go from one circle to another - its only a slight movement but its still happening - maybe its one of those physical impossibilities that you just cant get around lol
I still do not understand whats happening et ccould you explain it a little more detail etc sorry matey
NOW! look whats happened! I told you to watch this space and now its gone. 
-
this is really getting to me now, i think it really is physically impossible to do what i want to do because even if i dont change the size of the bubbles when you rollover or rollout, and just change the alpha, the same thing happens because you are rolling out and rolling over the next bubble, so the code is simply being followed. It needs some kind of condition statement like i mentioned above. Dawsonk's example fla (sizes1mx.fla) shows what i mean - roll over the bubbles in sequence, from left to right and right to left, and you will see that the one that is not being rolled over still obeys the script - its so hard to explain but when you see it you will understand EXACTLY what i mean! I think i may have to just think of another design for these bubbles
-
i'm confused now - there are no frames in that fla which i can add to or remove - the animation is all done by actionscript. (Are we looking at the same file?)
Theres no other way i can explain the problem - thats as simple as i can say it lol. Maybe try making an example of mine, and you might be able to see the problem
-
am using the one dansonk linked to.
if you have a look on the images below.
If you double click onto the buttons you will see the image above yes!
Now select one of the three buttons and double click onto that button. You will then get the image below.
As you can see on the TIMELINE there is the animation that is used to increase/decrease the buttons etc
hope this helps
NOW! look whats happened! I told you to watch this space and now its gone. 
-
with the second problem was that to do with my code or the dawsonk link file?
NOW! look whats happened! I told you to watch this space and now its gone. 
-
ah....my bad....yeah i see it now....i didnt double click the balls i just double clicked the movie and looked at the AS on the asl layer. *embarassed*
As for the 2nd problem, its to do with the dawsonk file (and my original work)....i dont know about yours as i havent had the chance to try it at work today.
-
so to get this right :
three balls
You roll over the first ball and it increases and the second and third decrease
You roll Out and all return to the normal size:
if so this is easy enough with a little twick I beleive, what your after originally is :
When you mouse over bubble 1, it increases in size, bubbles 2 and 3 become smaller. You then mouse over directly to bubble 2, which increases to a bigger size (not normal size), bubble 1 reduces, bubble 3 gets bigger and smaller again!
you need to move mouse quickly but as soon as you move the mouse to rollOut mode it would initiate that function so your nearly as close as you could get with the code etc
NOW! look whats happened! I told you to watch this space and now its gone. 
-
yeah basically i dont think you can be quick enough when you rollover and rollout. Its just one of those things and unfortunately i found it out the hard way and it took me....about a week! But thank you so much for your help. I have a really bad feeling that i will have to simply think of another idea
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|