RE: Flash Q&A thread 3 (Full Version)

All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy



Message


Myhos -> RE: Flash Q&A thread 3 (3/13/2007 20:12:29)

Eragon the are you going to be making games for profit? if yes then your going to have to pick up a pro version but as long as its a free game it most likely will be ok with the agreement, but as far as i know, you can't upgrade to pro, unless your upgrading to a newer version (when flash 9 comes out and you can get upgrade for the pro version)

alright now for helping with code;

First before we can help you, help us help you: add in some comments (//LOL COMMENT) in the code so we can see what your trying to do, ex:

_root.onEnterFrame = function(){
gotoAndStop(1) // go to the main frame, etc
}
styleup:
on(release){
if (style < 5){ // make sure that the style will be larger then 5 so this can work or that, blah blah
style += 1
}
}
}

also its much better to do this all on the frames instead of on the movie clips.




EragonZZZZ -> RE: Flash Q&A thread 3 (3/13/2007 21:38:36)

Yeah, Mythos, you're like a mind reader. Thats exactly what I'm going to do.

Why pay for a new version of the old when you can get a new version of the new?

Actually, I already have the beta, which ISN'T an education version. So technically, anything I do with Flash 9 is legal. Time to copy over all my graphics XD.




Myhos -> RE: Flash Q&A thread 3 (3/14/2007 8:15:39)

Lol unfortunately for me, the flash 9 beta only works with the old Power PC macs and not the new Intel chip macs :( (I have Flash 8 on my mac)




petermaxo -> RE: Flash Q&A thread 3 (3/14/2007 9:20:33)

quote:

ORIGINAL: flsg
petermaxo: wow, could you at least tell us what's wrong with your script? XD because nobody has the patience to read all that lol

I looked at some of the lines, and I don't understand why you're using onEnterFrame. This event allows you to replay the code inside it everytime a frame passes. That's perhaps your bug. just simply remove it(well, I'm not sure what you're trying to do XD)

also, if you define _root.onEnterFrame more than once, the newer code replace the older code(which means the older code inside your onEnterFrame event dissapear)

and, if you use if() a lot, I suggest you to use switch()+case, which is easier to read


I don't know a lot of code. I basicly taught myself to use everything to the fullest extent. about _root.onEnterFrame- 1. what else would I use? 2. I think you are misunderstanding my format. I only use onEnterFrame once per scene/clip. What is switch()+case?




ponycoltraine -> RE: Flash Q&A thread 3 (3/14/2007 18:10:12)

i used to be a scripter but gave it up for being an animator/drawer

i made a hand tut a little while ago its not my best but it helps
http://i81.photobucket.com/albums/j231/chubbs153/handtut.swf

and i cant post my other script link its a **********link




EragonZZZZ -> RE: Flash Q&A thread 3 (3/14/2007 18:57:54)

Haha, yeah, I figured out what newgrounds was when I saw your tutorial.

And flsg, AS 2.0 can do CASE? What?!?! Why didn't anyone TELL me? Arggghhh...That would've made my life so much easier...eeeeekkkk..

What's the syntax?




flsg -> RE: Flash Q&A thread 3 (3/14/2007 19:33:42)

eragon: are we talking about the same "case"?
switch (condition) {
case A :
  //code
  break
case B :
  //code
  break;
case C :
  // code
  break;
default :
  // code
  break;
}

example:
switch (_root.username.text) {
case "eragon" :
  trace("hi eragon")
  break
case "flsg" :
  trace("how are you flsg?")
  break;
case "Artix" ://without break, it's like using || in if()
case "Twilly":
  trace("I want to play AQ")
  break;
  default ://occurs when none of the conditions above are meet
  trace("hi")
  break;
}

petermaxo: I think you don't understand. onEnterFrame runs the code automatically every time a frame passes, event if you only have one frame in the entire movie




ponycoltraine -> RE: Flash Q&A thread 3 (3/14/2007 19:34:10)

well its on that one site that starts with new and thats all i can tell you and you can find it by searching big bad tutorial (for those who know the site u can find it if not sorry thats all i can say)




petermaxo -> RE: Flash Q&A thread 3 (3/15/2007 8:24:24)

flsg: but what should I use instead? Anyway, I've already said that my problem is that NOTHING happens.




Myhos -> RE: Flash Q&A thread 3 (3/15/2007 8:27:09)


quote:

ORIGINAL: EragonZZZZ

Haha, yeah, I figured out what newgrounds was when I saw your tutorial.

And flsg, AS 2.0 can do CASE? What?!?! Why didn't anyone TELL me? Arggghhh...That would've made my life so much easier...eeeeekkkk..

What's the syntax?


Syntax is a nasty little part of every language. Its pretty much the order of your code, underscores "_", ".", etc. syntax errors are the worst possible error.




petermaxo -> RE: Flash Q&A thread 3 (3/15/2007 8:31:18)

I think he wants you to tell him the syntax rules for cases.

edit: I have isolated the problem in my actionscript. The simplified problem codes are:

Scene 3:
_global.c = 0
_root.onEnterFrame = function(){
if(Key.isDown(Key.UP)){
c = 1
}if(Key.isDown(Key.DOWN)){
c = 2
}trace(c)
}

player (mc in Scene 3, contains mcs p1 and p2):

_root.onEnterFrame = function(){
if(c == 1){
p1._visible = true
}if(c != 1){
p1._visible = false
}if(c == 2){
p2._visible = true
}if(c != 2){
p2._visible = false
}

}

again, the problem is that all coding is not working once the scene is entered. italicised parts are not bugged.

edit 2:
I figured out how to make it work if you press the player movie clip. If someone could tell me how to do it with seperate buttons, that would be good.

I added this code to the movie clip
onClipEvent(mouseDown){
c = 2
}




Myhos -> RE: Flash Q&A thread 3 (3/15/2007 9:21:03)

ok well first of all, you have some unneeded code, I changed it and fixed it up:

_global.c = 0; //(you forgot EVERY semicolon DOH!)
_root.onEnterFrame = function(){
if(Key.isDown(Key.UP)){
c = 1;
}if(Key.isDown(Key.DOWN)){
c = 2;
}trace("c"); // (I fixed your trace function, it should work now)
}
_root.onEnterFrame = function(){
if(c == 1){
p1._visible = true;
p2._visible = false;
trace("P1 visible is working"); // you can kill this line of code if it works
}
}if(c == 2){
p2._visible = true;
p1._visible = false;
trace("P1 visible is working"); // you can kill this line of code if it works
}
}



It should work now n_n
btw a stop(); command should help a tad bit in there




petermaxo -> RE: Flash Q&A thread 3 (3/15/2007 9:27:56)

I thought that semicolons were optional, and I almost never use them, and I have never had any trouble before. Also, the trace function is supposed to trace the variable c, not the message "c". It doesn't trace c or "c", and if I want to do anything bigger, it is much longer than my original. And it still doesn't work.




Myhos -> RE: Flash Q&A thread 3 (3/15/2007 9:31:55)

Hmmm lets see....try this:

instead of _global.c = 0

do:

var c = 0;

btw what version of flash and action script are you useing?

also its better to put semicolons after each statment




petermaxo -> RE: Flash Q&A thread 3 (3/15/2007 15:50:13)

does using var have the same effect as _global., i.e. it globalizes the variable?

Flash MX 2004, educational version.




EragonZZZZ -> RE: Flash Q&A thread 3 (3/15/2007 17:57:01)

Whoops, I was thinking of a totally different case >.> <.<

and as for this:

quote:

Syntax is a nasty little part of every language. Its pretty much the order of your code, underscores "_", ".", etc. syntax errors are the worst possible error.


Don't worry, I know what syntax is. I meant the syntax for the "case" language element which actually doesn't exist. I got "case" confused with "stacks"

Which, ironically, I figured out (by meself) that flash can do! Yay!





Myhos -> RE: Flash Q&A thread 3 (3/15/2007 20:30:17)

alright try this:

init();
function init(){
var c = 0;
}
onEnterFrame = function(){
if(Key.isDown(Key.UP)){
c = 1;
}if(Key.isDown(Key.DOWN)){
c = 2;
}trace(c);
}




petermaxo -> RE: Flash Q&A thread 3 (3/16/2007 16:57:23)

same problem as before. c isn't traced, the mc does nothing.




Myhos -> RE: Flash Q&A thread 3 (3/16/2007 17:06:52)

damn... email me a example of the flash file, let me take a crack at it




petermaxo -> RE: Flash Q&A thread 3 (3/16/2007 17:21:07)

How do you attatch .fla files to an email through the forum? (or anything else?)




flsg -> RE: Flash Q&A thread 3 (3/16/2007 18:32:05)

I'm back
petermaxo: you should learn a little bit the variable scope
your code doesn't work because:
this.p1 and this.p2 since they're not in _root
the second onEnterFrame just erased the first one because you re-declarated it




petermaxo -> RE: Flash Q&A thread 3 (3/16/2007 18:50:50)

Oh! now I get it. Thanks

edit: It Works!!!

By the way, what class should you export dynamicly created movie clips as?




flsg -> RE: Flash Q&A thread 3 (3/17/2007 13:19:44)

dynamically created MC? I don't understand your question...
you create run-time mc by using targetName.createEmptyMovieClip()




petermaxo -> RE: Flash Q&A thread 3 (3/17/2007 16:48:26)

Never mind, I figured it out. By the way, is there any way to make something happen when the last frame of movie clip is loaded?

Edit: also, I have a string of code trying to attatch a movie clip to the _root. and make it play. Here is the (somewhat shortened) code:

_root.onEnterFrame = function(){
if(back == 1){
_root.attachMovie("grassback", "back", 1,{_x:225,_y:200})
}if(ename == "green slime"){
_root.attachMovie("greenslimeattack", "enemy", 2,{_x:400,_y:200})
}_root.enemy.play()
}

sometimes, the movie clip 'greenslimeattack' won't play, or it will be delayed. does anyone know what's wrong?




flsg -> RE: Flash Q&A thread 3 (3/19/2007 21:28:16)

you use too much onEnterFrame, but for now it's ok
what do you mean by the last frame? Do you mean to run a code when the mc is fully loaded? Or else just put a piece of code on that last frame




Page: <<   < prev  1 2 [3] 4 5   next >   >>

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition
0.1074219