PDA

View Full Version : My first Flash project... Need some input...


RockinAkin
12-10-2002, 06:37 AM
Hi All,

This is the first project I've attempted since I first got flash mx.
I wanted to create a template to show off my 3D models, and heres the start of what I came up with... kinda like a Quicktime VR. (The teapot is just a quick example model).

My Model Viewer (http://users.starpower.net/kamaelec/FlashRotate.swf) (Its 280K)

I'm thinking of eventually adding a "Switch to wireframe view" button too... it shouldn't be too hard eh?

But does anyone know of a way for me to create 2 more buttons that will automatically rotate for you, without having to continually click the current right/left buttons?
Just like what the current buttons do, but non-stop continuously.

Thats all for now,
Tell me what you think!
-DivideByZero-

J_A_X
12-10-2002, 03:46 PM
not bad at all....xcept for the shadow on that thing is ****ed up...
wut would be nice is to have a mouse actionscript...ya know...put your mouse on the right and the teapot spins on its own...that kind of thing...

RockinAkin
12-10-2002, 07:06 PM
wut would be nice is to have a mouse actionscript...ya know...put your mouse on the right and the teapot spins on its own...that kind of thing...
Yeah, thats kinda what I said in the first post.... :hmm:
Just need to know HOW to do that... any tips?

-DivideByZero-

Per-Anders
12-10-2002, 07:23 PM
well you can just take teh mouses x position, divide by the total idth of teh movie and multiply up by the number of frames, then it will be linked witht eh mouses position, or you could use movieclips instead of buttons, as they're evaluated every frame, then you can do a simple, if button pressed then set rotating=true and in the main part of the movieclip button, set it so that if rotating=true then rotate x ammount, then on mouseup rotate=false type affair.

should work well... and your polys need to be double sided, or have a decal texture on them as that's what's causing the shadow problem.

RockinAkin
12-10-2002, 07:51 PM
Again, the teapot is just an example model... wipped together in 5 seconds... noting to crit. :rolleyes:

mdme_sadie... im still new to flash, and didn't get a word you said... :hmm: sorry.

Those two buttons have nextframe / previousframe actionscripts assigned to them.

Now, anyone know how to make those two buttons goto the next frame / previous frame at a rapid rate?

-DivideByZero-

fig
12-10-2002, 08:33 PM
to put what mdme said into code, put the frames for the iamge rotation into a movieclip with stop actions on each frame, then on your button something to the effect of

on(press) {
rotating == true;
}

on(release) {
rotating == false;
}

then on your timeline

if (rotating = true) {
_root.imagerotationclip.nextFrame();
}

that close mdme? my syntax may be a bit off...

chris

Per-Anders
12-11-2002, 02:40 AM
yeah, something like that, of course you will need different variables (i.e. rotateleft, and rotateright) for each direction.. but htat hsould do the trick, and of course the rotating==true should be rotating=true (not two equals signs) and the if statement should instead have the double == operator in it. but apart from that that's about it :)

RockinAkin
12-11-2002, 02:58 AM
Well, I gave it a shot but it didn't work.
The debugger doesn't find anything wrong with the code, but when i try to test the movie, it just stops at the first frame, and the buttons are unresponsive.

In my original file:
I've got one layer with all of my images lined up in order.
One layer with nothing but "stop" commands for each frame and "goto frame 1"/"goto frame 30" commands on each side of the timeline to create the loop
And one layer that contains the buttons, which have "previous frame"/"next frame" commands on them.

Now i just need to get two buttons to perform the next/previous frames rapidly as the mouse hovers over them.

Hope that helps,
-DivideByZero-

Per-Anders
12-11-2002, 03:23 AM
make sure the movieclip buttons don't overlap the normal buttons

then make sure the base timeline has three frames, an innitial one to set variable in (in here set the rotateleft and rotateright variables to false, or if you're using one varibale set it to the neutral value which means there's no rotation).

frame two contains the in rotate==whatever commands
frame 3 contains a gotoAndPlay(2); to play the second frame in a loop... it's important for this to work for the playhead to keep moving.

hope that this helps.

oh yeah and in the movieclip buttons you will also want hittess to detect if the mouse is within them on the onClipEvent(mouseDown) { statment

should read something like this

onClipEvent(mouseDown) {
if (_root.hitTest(_root._xmouse,_root._ymouse,false)) {
rotate=true;
}
}

the same hittest if statements shouldnt be put in the mouseup statements otehrwise you may find the person drags the mouse outside ofthe button and releases, yet the clip is still trying to rotate...

also a better route than teh two variables rotateleft, and rotateright, would be just hte one, and if one movieclip button is pressed then it's set to 1, if another is pressed it's set to -1 and if it's not pressed it's set to 0, that should avaiod most bugs.

hope that this helps, and you can work out what i mean :)

fig
12-11-2002, 03:53 AM
heh, thanks, at least i was sorta close. had i been actually writing out the code to use i think i would've figured it out reasonably quickly :D

chris

Maxx
12-12-2002, 11:48 AM
Actually, mdme_sadie - because it's MX, you don't have to do a hittest for the movie clip anymore. Just use the movie clip as a button.

DivideByZero - In your fla, make sure that your arrow is set as a movie clip in the library. Also make sure that each of the instances is named. Now, in each instance timeline, add three frames at the beginning of the timeline. Label these frames "_up", "_over" and "_down" (without the quotes). This will make the movie clip emulate a button, though it'll respond to movie clip events. On the main timeline you can add you AS to the instances - try adding either an on(press) event trigger or a mouse listener. (you can look up listeners in the manual - I personally don't have a lot of experience with them)

Anyway, hope this helps. :)

P.S. - even tho' the movie clip has the button frames, it won't act like a button until you put an event handler on the instance. (This drove me nuts at first, 'cause my buttons weren't working.) If the buttons aren't, just add :

on(release){
}

to the button. This'll get Flash to recognize it as a button.

arjun
12-12-2002, 09:33 PM
Okkk. ;)
Anyways, I would seriously recommend Swift3d because it can rotate stuff. You won't have this button thing unless you program it to move one frame in the swift3d animation but at least it will turn smoothly. It comes with a 3dsmax plugin so it can import files like your max scene into it and rotate it.

Good though :airguitar

Maxx
12-13-2002, 05:49 PM
Hate to do this - but I'm an idiot. I should have checked my info first - totally ignore my previous post. Sorry mdme_sadie - you're right. I coulda sworn that a mouse listener would work. Anyway, I'm working on a very similar situation right now, so I'm gonna take mdme_sadie advice myself. If I figure out any different ways, I'll post here.

Like I said, sorry guys and gals.... :argh:

Maxx
12-13-2002, 06:13 PM
Here's another way of handling what you're looking for. The actions happen on the "filmOptions" timeline in the file - it's multiple frames that cause the motion of the strip. All you'll have to do is change the target paths to your spinning teapot timeline and all should be good. Let me know if you need any help with this or if it doesn't work or anything like that, okay? Ignore the design elements in the file - they're WIP so kind of rough right now.

Maxx
12-13-2002, 06:15 PM
Here's another way of handling what you're looking for. The actions happen on the "filmOptions" timeline in the file - it's multiple frames that cause the motion of the strip. All you'll have to do is change the target paths to your spinning teapot timeline and all should be good. Let me know if you need any help with this or if it doesn't work or anything like that, okay? Ignore the design elements in the file - they're WIP so kind of rough right now.

http://www.cessories.com/tester/constantMotion.zip

RockinAkin
12-13-2002, 08:15 PM
Thanks for the tips guys... especially Maxx for letting me check out that file.
I've got it working like a charm now!

-DivideByZero-

Maxx
12-13-2002, 08:20 PM
Glad it could help. The file I uploaded isn't as pretty coding-wise as mdme_sadie's work, but I'm glad it got you going in the right direction.

Michael Chen
12-21-2002, 10:21 PM
Is your site still up there?

I can't view it apparently :p

CGTalk Moderation
01-13-2006, 11:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.