Flash Action Script Problemo

  • ksufan
  • Novice
  • Novice
  • ksufan
  • Posts: 21

Post 3+ Months Ago

Hello fellow programmers :)

i'm re using code in my current project that i'm using. I'm making a new member registration form for a website that i'm building. I build an interface with a movie clip called joinForm. Within the movie clip i have my input components with the require instances. somehow i'm not getting that thing to work.



Code:
stop();

// --------------------<send from LoadVars>-------------------- \\
var gatherForm:LoadVars = new LoadVars();

function sendForm() {
gatherForm.email_to = "ksuisa0607@gmail.com";
gatherForm.visitor_lastname = joinForm.userLastName.text;
gatherForm.visitor_name = joinForm.userName.text;
gatherForm.visitor_email = joinForm.userEmail.text;
gatherForm.visitor_origin = joinForm.userOrigin.text;

if (joinForm.userFreshman.selected){
gatherForm.visitor_freshman = true
}
if (joinForm.userSophomore.selected){
gatherForm.visitor_sophomore = true
}
if (joinForm.userJunior.selected){
gatherForm.visitor_junior = true
}
if (joinForm.userSenior.selected){
gatherForm.visitor_senior = true
}


gatherForm.send("http://ksuisa.org/send.php","POST");
}

// --------------------</send from LoadVars>-------------------- \\

_global.style.setStyle("fontFamily", "Bitstream Vera Sans");
_global.style.setStyle("fontWeight", "bold");
_global.style.setStyle("fontSize", 12);
_global.style.setStyle("color", 0x000000);


//--------------------<submit button AS>---------------------\\

this.joinForm.submitBtn.Submit.autoSize = "center";
this.joinForm.submitBtn.Submit.text = "submit";

onRollOver
this.joinForm.submitBtn.onRollOver = function() {
this.joinForm.submitBtn.gotoAndStop (2);
}

onRollOut
this.joinForm.submitBtn.onRollOut = function() {
joinForm.submitBtn.gotoAndStop (1);
}

onRelease
this.joinForm.submitBtn.onRelease = function() {
if (joinForm.userEmail.text == "" || joinForm.userName.text == "") {
gotoAndStop("error");
} else {
sendForm();
gotoAndStop("correct");
}
}

I saved as Inside Join just letting you know.
thanks!
Gabriel
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

WHere are ya stuck @ exactly ?
  • ksufan
  • Novice
  • Novice
  • ksufan
  • Posts: 21

Post 3+ Months Ago

Is it alright that i send you my fla file to you so you can take a look. I don't know what am i doing wrong. Sad

Gabriel
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

the code looks ok, but i think u have problems with the paths.
Your rollOver works correctly?
if not, then that's the problem.
i think your code should look like this:

Code: [ Select ]
//onRollOver
this.joinForm.submitBtn.onRollOver = function() {
this.gotoAndStop (2);
}

//onRollOut
this.joinForm.submitBtn.onRollOut = function() {
this.gotoAndStop (1);
}

this.joinForm.submitBtn.onRelease = function() {
if (this._parent.userEmail.text == "" || this._parent.userName.text == "")
{
 this._parent._parent.gotoAndStop("error"); /* depends where u have the "error" frame; in this case i presume it's in _root */
} else {
this._parent._parent.sendForm(); // i think here it works with simple: sendForm(); you can test it
this._parent._parent.gotoAndStop("correct");
}
  1. //onRollOver
  2. this.joinForm.submitBtn.onRollOver = function() {
  3. this.gotoAndStop (2);
  4. }
  5. //onRollOut
  6. this.joinForm.submitBtn.onRollOut = function() {
  7. this.gotoAndStop (1);
  8. }
  9. this.joinForm.submitBtn.onRelease = function() {
  10. if (this._parent.userEmail.text == "" || this._parent.userName.text == "")
  11. {
  12.  this._parent._parent.gotoAndStop("error"); /* depends where u have the "error" frame; in this case i presume it's in _root */
  13. } else {
  14. this._parent._parent.sendForm(); // i think here it works with simple: sendForm(); you can test it
  15. this._parent._parent.gotoAndStop("correct");
  16. }
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

also one tip. for this type of code:
Code: [ Select ]
if (joinForm.userFreshman.selected){
gatherForm.visitor_freshman = true
}
  1. if (joinForm.userFreshman.selected){
  2. gatherForm.visitor_freshman = true
  3. }

when you are testing if a a bool value is true, then set another bool value, you can reduce the amount of code by one line:

Code: [ Select ]
gatherForm.visitor_freshman = joinForm.userFreshman.selected;

or, if you want the negated value:
Code: [ Select ]
gatherForm.visitor_freshman = !joinForm.userFreshman.selected;


also, you can use the operand "?"
Code: [ Select ]
value = (condition)?value1:value2;

in this case, if the condition is true, value gets value1, if it's false, value gets value2; where condition can be a complex condition.
i.e.:
Code: [ Select ]
a = (2>4 && 9<15)?5:3;
trace(a); // -> output = 3, cos 2 is not > than 4
  1. a = (2>4 && 9<15)?5:3;
  2. trace(a); // -> output = 3, cos 2 is not > than 4
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

yep it was paths problemos ...
solved .
  • classified
  • Expert
  • Expert
  • User avatar
  • Posts: 540
  • Loc: Bahrain

Post 3+ Months Ago

code :::


Code: [ Select ]
stop();

// --------------------<send from LoadVars>-------------------- \\
var gatherForm:LoadVars = new LoadVars();

function sendForm() {
    gatherForm.email_to = "ksuisa0607@gmail.com";
    //----------------------------this refers to cuurent stage so you dont need to put in gather as path ...
    gatherForm.visitor_lastname = this.userLastName.text;
    gatherForm.visitor_name = this.userName.text;
    gatherForm.visitor_email = this.userEmail.text;
    gatherForm.visitor_origin = this.userOrigin.text;
    trace(gatherForm.visitor_lastname + gatherForm.visitor_name +     gatherForm.visitor_email + gatherForm.visitor_origin);
    //changed from joinForm.userFreshman to this.userFreshman
    if (this.userFreshman.selected){
  //
  this.visitor_freshman = true;
  trace('1?');
  }
  if (this.userSophomore.selected){
  gatherForm.visitor_sophomore = true ;
  trace('2?');
  }
  if (this.userJunior.selected){
  gatherForm.visitor_junior = true;
  trace('?3');
  }
  if (this.userSenior.selected){
  gatherForm.visitor_senior = true;
     trace('?4');
}
    
    
    //gatherForm.send("http://ksuisa.org/send.php","POST");
}

// --------------------</send from LoadVars>-------------------- \\

_global.style.setStyle("fontFamily", "Bitstream Vera Sans");
_global.style.setStyle("fontWeight", "bold");
_global.style.setStyle("fontSize", 12);
_global.style.setStyle("color", 0x000000);


//--------------------<submit button AS>---------------------\\

this.submitBtn.Submit.autoSize = "center";
this.submitBtn.Submit.text = "submit";

//onRollOver
this.submitBtn.onRollOver = function() {
    this.gotoAndStop (2);
}

// onRollOut
this.submitBtn.onRollOut = function() {
    this.gotoAndStop (1);
}

onRelease
this.submitBtn.onRelease = function() {
    if (userEmail.text == "" || userName.text == "") {
        gotoAndStop("error");
    } else {
        sendForm();
        gotoAndStop("correct");
    }
}
  1. stop();
  2. // --------------------<send from LoadVars>-------------------- \\
  3. var gatherForm:LoadVars = new LoadVars();
  4. function sendForm() {
  5.     gatherForm.email_to = "ksuisa0607@gmail.com";
  6.     //----------------------------this refers to cuurent stage so you dont need to put in gather as path ...
  7.     gatherForm.visitor_lastname = this.userLastName.text;
  8.     gatherForm.visitor_name = this.userName.text;
  9.     gatherForm.visitor_email = this.userEmail.text;
  10.     gatherForm.visitor_origin = this.userOrigin.text;
  11.     trace(gatherForm.visitor_lastname + gatherForm.visitor_name +     gatherForm.visitor_email + gatherForm.visitor_origin);
  12.     //changed from joinForm.userFreshman to this.userFreshman
  13.     if (this.userFreshman.selected){
  14.   //
  15.   this.visitor_freshman = true;
  16.   trace('1?');
  17.   }
  18.   if (this.userSophomore.selected){
  19.   gatherForm.visitor_sophomore = true ;
  20.   trace('2?');
  21.   }
  22.   if (this.userJunior.selected){
  23.   gatherForm.visitor_junior = true;
  24.   trace('?3');
  25.   }
  26.   if (this.userSenior.selected){
  27.   gatherForm.visitor_senior = true;
  28.      trace('?4');
  29. }
  30.     
  31.     
  32.     //gatherForm.send("http://ksuisa.org/send.php","POST");
  33. }
  34. // --------------------</send from LoadVars>-------------------- \\
  35. _global.style.setStyle("fontFamily", "Bitstream Vera Sans");
  36. _global.style.setStyle("fontWeight", "bold");
  37. _global.style.setStyle("fontSize", 12);
  38. _global.style.setStyle("color", 0x000000);
  39. //--------------------<submit button AS>---------------------\\
  40. this.submitBtn.Submit.autoSize = "center";
  41. this.submitBtn.Submit.text = "submit";
  42. //onRollOver
  43. this.submitBtn.onRollOver = function() {
  44.     this.gotoAndStop (2);
  45. }
  46. // onRollOut
  47. this.submitBtn.onRollOut = function() {
  48.     this.gotoAndStop (1);
  49. }
  50. onRelease
  51. this.submitBtn.onRelease = function() {
  52.     if (userEmail.text == "" || userName.text == "") {
  53.         gotoAndStop("error");
  54.     } else {
  55.         sendForm();
  56.         gotoAndStop("correct");
  57.     }
  58. }
  • ksufan
  • Novice
  • Novice
  • ksufan
  • Posts: 21

Post 3+ Months Ago

Hey all,


Thank you so much for your assistance. Everything is working the way but I cannot not really test on the student server at Kennesaw State University because they don't have php installed. I'm still waiting for my group on the webhosting service. Anways thanks again.

Cheers,

Gabriel

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 15 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.