Page 8 of 13

Re: Flash

Posted: Tue Aug 04, 2009 7:59 am
by neronix17
SpiritWebb wrote:Whatever you did, it fixed it!! Thank you.

Now, with that code, what code can be replaced with below, for the mouse click movement?

Code: Select all

onClipEvent (load) {
rad = 0.0174532925199433;
speed = 5;
moving = false;
}
onClipEvent (mouseDown) {
moving = true;
m = {x:_parent._xmouse, y:_parent._ymouse};
}
onClipEvent (enterFrame) {
if (moving) {
mcx = _x-m.x;
mcy = _y-m.y;
_rotation = -Math.atan2(mcx, mcy)/rad;
mr = _rotation*rad;
if (Math.sqrt((mcx*mcx)+((mcy)*(mcy)))>speed) {
_y -= speed*Math.cos(mr);
_x -= -(speed*Math.sin(mr));
} else {
_x = m.x;
_y = m.y;
moving = false;
}
}
}
I honestly have no idea, ive never worked with mouse click movement sorry:(

Re: Flash

Posted: Tue Aug 04, 2009 8:02 am
by SpiritWebb
Np...I will play around with that code you gave me, Thanks for that btw, and see where I can implement it!! :D

Re: Flash

Posted: Wed Aug 05, 2009 7:50 am
by SpiritWebb
neronix17 wrote:
SpiritWebb wrote:Whatever you did, it fixed it!! Thank you.

Now, with that code, what code can be replaced with below, for the mouse click movement?

Code: Select all

onClipEvent (load) {
rad = 0.0174532925199433;
speed = 5;
moving = false;
}
onClipEvent (mouseDown) {
moving = true;
m = {x:_parent._xmouse, y:_parent._ymouse};
}
onClipEvent (enterFrame) {
if (moving) {
mcx = _x-m.x;
mcy = _y-m.y;
_rotation = -Math.atan2(mcx, mcy)/rad;
mr = _rotation*rad;
if (Math.sqrt((mcx*mcx)+((mcy)*(mcy)))>speed) {
_y -= speed*Math.cos(mr);
_x -= -(speed*Math.sin(mr));
} else {
_x = m.x;
_y = m.y;
moving = false;
}
}
}
I honestly have no idea, ive never worked with mouse click movement sorry:(
So, with the code you gave me, is there a way to incorporate planets? I tried placing a planet down on the stage and ran it, but it never showed up. What am I doing wrong?

Re: Flash

Posted: Wed Aug 05, 2009 12:14 pm
by neronix17
yeah you would have to do the same as what you have to with the map_mc clip, but add something to make them act like they are physically there, i guess they would have to move with the map_mc too so that you can move around them, if you make a copy of the original and play around with it then you can figure out what each bit does and use that to add planets, i cant do it for u though. :lol:

Re: Flash

Posted: Thu Aug 06, 2009 7:21 pm
by SpiritWebb
Alright, so I was working with the mouse click movement code today, and for some reason, when I apply the code the "player" the ship travels at an angle rather then traveling forward. Need help correcting the code movement.

Code: Select all

onClipEvent (load) {
rad = 0.0174532925199433;
speed = 5;
moving = false;
}
onClipEvent (mouseDown) {
moving = true;
m = {x:_parent._xmouse, y:_parent._ymouse};
}
onClipEvent (enterFrame) {
if (moving) {
mcx = _x-m.x;
mcy = _y-m.y;
_rotation = -Math.atan2(mcx, mcy)/rad;
mr = _rotation*rad;
if (Math.sqrt((mcx*mcx)+((mcy)*(mcy)))>speed) {
_y -= speed*Math.cos(mr);
_x -= -(speed*Math.sin(mr));
} else {
_x = m.x;
_y = m.y;
moving = false;
}
}
}

Re: Flash

Posted: Mon Aug 17, 2009 8:08 pm
by SpiritWebb
Alright, so I decided to re-build the login with flash. I have all my fields in place, it connects, but sits at transferring. It doesn't seem to be doing anything. Am I doing something wrong?

Flash: username (user input text) - instance: userinput, var: user; password (user input text) - instance: passinput, var: pass.

flash code:

actions

Code: Select all

stop();

userinput.restrict="a-zA-Z0-9";
passinput.restrict="a-zA-Z0-9";

Selection.setFocus(userinput);

status="Enter your information and login";

this.onEnterFrame = function () 
{
	if(_root.checklog == 1){
		_root.gotoAndStop(10);
	}
	if(_root.checklog == 2){
		_root.gotoAndStop(15);
	}
	if(_root.checklog == 3){
		_root.gotoAndStop(7);
	}
}
//the onEnterFrame constantly checks to see if the PHP
//script has sent the variable 'checklog' back to the
//movie and directs the people accordingly
login

Code: Select all

on (release, keyPress "<Enter>") {
	
	if (user != "" && pass != "") {
		status = "Logging in, please wait...";
		loadVariablesNum("authenticate.php", 0, "POST");
	}
}
Note that status is a dynamic text box that just shows a message.

PHP:

connect

Code: Select all

<?php

$db = mysql_connect("localhost","root","") or die("Could not connect to db");
mysql_select_db("undiscovered") or die("Could not connect, please try again");

?>
authenticate

Code: Select all

    <?php

      $user=$_POST['user'];
      $pass=$_POST['pass'];

      //connect to database
      include_once 'connect.php';
      session_start();

      $query = "SELECT * from players where name='$user' and password='$pass'";
      $result = mysql_query($query) or die ("didn't query");


      //see if there's an EXACT match
      $num = mysql_num_rows($result);
      if ($num == 1){
	echo "status=Welcome&checklog=1";
	} else {
	echo "status=Please try again!&checklog=2";
        }

?>
It doesnt seem to be verifying the information in the database is correct, so its not moving on. Just sits in the transfering from localhost, thats it. If successfull, its supposed to go to frame 10, which is the index frame in flash. Otherwise the status message is to say, please try again! Help...

Re: Flash

Posted: Tue Aug 18, 2009 8:53 am
by neronix17
if that code is exactly what you are using then it might help having the password for it (im guessing you removed that for security though lol), Ive tried with similar coding a few days ago trying to incorporate my avatars into my game, didnt do anything when I pressed the Login button though :(

EDIT: We both used the same tutorial on kirupa.com then, cus my one does the exact same as with yours, I think Ive figured out why but Il go make sure Im right about it before I post the fix.

EDIT: Yeah, I was wrong lol, turns out it was just the flash itself, the successful login frame is 15, so thats where that stuff goes, make sure you publish the animation as html and use that since .swf version doesnt seem to work right. :?

EDIT AGAIN :( Thats wrong too, now it just sits at the login screen, sorry.

Re: Flash

Posted: Tue Aug 18, 2009 6:54 pm
by SpiritWebb
neronix17 wrote:if that code is exactly what you are using then it might help having the password for it (im guessing you removed that for security though lol), Ive tried with similar coding a few days ago trying to incorporate my avatars into my game, didnt do anything when I pressed the Login button though :(

EDIT: We both used the same tutorial on kirupa.com then, cus my one does the exact same as with yours, I think Ive figured out why but Il go make sure Im right about it before I post the fix.

EDIT: Yeah, I was wrong lol, turns out it was just the flash itself, the successful login frame is 15, so thats where that stuff goes, make sure you publish the animation as html and use that since .swf version doesnt seem to work right. :?

EDIT AGAIN :( Thats wrong too, now it just sits at the login screen, sorry.
Yeah, we may have used the same tutorial. If I can figure it out, I will let you know also... :?

Re: Flash

Posted: Tue Aug 18, 2009 9:37 pm
by neronix17
thanks :D

Re: Flash

Posted: Mon Aug 24, 2009 10:03 pm
by SpiritWebb
Still having no luck correcting that code (above). It still sits at transferring. Starting to get really frustrated. Been going over this same code since the 16th...grrr...