Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 Flash Help
Index -> Graphics and Design, Web Design -> Flash MX Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message

PostPosted: Fri Sep 26, 2003 1:31 pm   Post subject: Flash Help

Since there isnt one already, Ill make a thread for help on flash.

And to start, does anyone know how to have a button/movie clip that you can click and then hide?

Im thinking it would use some AS like unload movie, but im not so hot with AS... any ideas?

PostPosted: Fri Sep 26, 2003 5:13 pm   Post subject: (No subject)

i dunno, maybe u can have a mask of some sort ;?

PostPosted: Fri Sep 26, 2003 5:18 pm   Post subject: (No subject)

cant you ActionScript onClick for that button?

button.hide or something.
Then continue action desired.

Or you can just place a white box over the button Laughing
Latest from Tony's programming blog. DWITE - a programming contest.

PostPosted: Fri Sep 26, 2003 5:19 pm   Post subject: (No subject)

lol, probably...i've never really used actionscript too much

PostPosted: Sat Sep 27, 2003 11:20 am   Post subject: (No subject)

What it is, is a game based on an inside joke between me my mom dad and aunt.

She made coffee, and when it was ready, and poured and stuff, there were grinds in it, so she was picking them out, and so were my parents, and my aunt went into the kitchen for something, and came out and my mom was still picking them out of her coffee, and my aunt said "More grinds?" I thought it was funny cause it seemed like she was asking my mom if she wanted more grinds, lol.

So I started making this game and it was a mug, filled with coffee grinds, and you had to pick them out in a certain amount of time, and if you didnt get them all, there would be a more grinds sound effect, and somone would put in more grinds.

the problem I encountered was that I drew a grind symbol, placed a few of them in the mug, copy/paste them (too lazy to manually place 30+ grinds), then when you click one grind, they all dissappear.

I dont know if it was cause the AS got put on the symbol, or if I didnt use instances right, but something messed up.

its been a while, and I havent touched that program, but I will try to do something with it soon.

any ideas would rock.

PostPosted: Sun Sep 28, 2003 1:21 am   Post subject: (No subject)

well copy/paste might have something to do with it.

Can't you just write a forloop to randomly create 30 instances of the grind and place it randomly into the mug?
Latest from Tony's programming blog. DWITE - a programming contest.

PostPosted: Sun Sep 28, 2003 1:36 am   Post subject: (No subject)

If i got you right,
you want is so that, if a person click the button...the button gets hidden?
well err if thats so,
check the attachment

i just used, go to actionscript on the button ;D sent to to frame number 2 which has the actionscript stop
(frame number 1 has the actionscript stop also)


PostPosted: Thu Feb 05, 2004 2:54 am   Post subject: (No subject)

OK ummm amailer... I don't think that is what hes getting at... cory... your problem is that all your instances have the same name... because of your copying and pasting.
I figure you should have something like this...


// Suppose that your height and width of your grains are 10 by 10
cgWidth = 10;
cgHeight = 10;
// Initialize variables for coffee grains randomize location... and set status to true
for (i = 1; i>10;i++;){
     cgX [i] = Math.random *400;
     cgY [i] = Math.random *300;
     cgStat [i] = true;

function HideGrains (){
 // You can just make out if statements for these by yourself... or use an arry to help you save lines
// name your instances from like 1 to 30... eg cg1, cg2, cg3....cg29, cg30
//thats the simplest way I can see doing it right now

// If the grain is clicked on
    // Check the if statement for all the grains
    for (i=1;i>10;i++){
        // If the grain is inside any of the coordinates for grains then
        if(_this._x +_this.width < cgX(i)+cgWidth & _this._x +_this.width > cgX(i) & _this._y +_this.height < cgY(i)+cgHeight  _this._x +_this.width > cgY(i)  & cgStat = true){
              // Hide this grain
              cgStat = false;

If your not sure what that does then just say so... but its for the most part... just checking for the value of the coffee grain you clicked on... value of cgStat ... and then hiding the ones that have a cgStat=false;

Confused ok might have been confusing Confused

PostPosted: Tue Feb 17, 2004 11:08 pm   Post subject: (No subject)

a few tips...

first, you really shouldn't be putting all your code into movie clips. once you start to make complex programs, you will lose track of where all the code is located... i understand if you're still using F5 but with FMX oyu should store all your code in a layer called actions and in the first frame of that layer. another thing is that you shouldnt really use buttons. they are very limited and besides using movieclips is almost as easy and they are much more versetile...

anyways, here's an example of what i mean and hopefully it solves your problem too... by the way i just duplicated the movieclips using AS and used hitTest to check whether you clicked on the grains...

btw delta, in your if statement, you used if(something = something else) {}
remember that when you are comparing stuff in iff statements you compare with ==...

PostPosted: Wed Feb 18, 2004 10:24 am   Post subject: (No subject)

Putting the code related to that movieclip into that movieclip isn't bad at all... and its alot easier to keep track of...
as for the coding....well see thats the thing... while comparing somethings... usually boolean comparison uses the '==' unless it was '=' can't remember :S but ya.... should have been fine...

PostPosted: Wed Feb 18, 2004 9:20 pm   Post subject: (No subject)

if you use '=' in an if statement, you wont be comparing the two, you'll just be assigning a value to the first variable.... and now with flash mx and flash mx2, most flash programmers put all their code in the first frame of the actions layer.... only those who use flash 5 or still have'nt updated their skills put their code in movie clips.... i used to put my code into movieclips but now i see how that was really bad prcatice. you too will see this as you gain more experience...

PostPosted: Wed Feb 18, 2004 10:07 pm   Post subject: (No subject)

well see thats the thing dude... say that you duplicate a new movie... that movie needs its variables... say x and y set... the best way (at least for what I'm thinking) is on (load){x=3;y=453;} especially if you don't want the code flying everywhere.... just trust me on this dude... thats a perfectly fine way of doing it... I just don't think your seeing it from the same spot I am

PostPosted: Wed Feb 18, 2004 11:21 pm   Post subject: (No subject)

did you even look at the fla i posted? i dunno, i guess it's ultimately up to the programmer's preference, but if you're planning on sharing any of your projects with other people say if you're developing a game with a team, you should really get used to putting all your code in one frame -_-

also about the initializing the variables of the duplucated MC's, you could do that when you duplicate them as seen in the fla i posted... both our code does the same thing but mine is at an easily accessible area. what happens if you have moviesclips within your movieclips that need code... that will get really messy...
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> Flash MX Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to: