|
-
Could someone (Chris) explaine what's happening in AS?
I was looking at the code in Chris' coding and I was wondering if someone could explain some things.
I'm starting to get the hang of a lot of this Action Scripting stuff but somethings get really confusing. Just when I thought I was learning the logic, something new comes across my screen.
Could someone comment what is happening in this code? I've removed some fields to make it easier to comment.
I've been trying to learn more about functions at Macromedia's site but their documentation ... sucks.
code:
but1.onPress=function(evt){
if (first.text == "" || last.text == "") {
theresult.gotoAndPlay("go");
theresult.myresult.text = "Empty Fields";
} else {
var result_lv= new LoadVars();
result_lv.onLoad = function(success) {
if (success) {
first.text="";
last.text="";
theresult.gotoAndPlay("go");
theresult.myresult.text = result_lv.returnMe;
} else {
theresult.gotoAndPlay("go");
theresult.myresult.text = "Error";
}
};
var send_lv = new LoadVars();
send_lv.action = "send";
send_lv.first = first.text;
send_lv.last = last.text;
send_lv.sendAndLoad("mymailform.php", result_lv, "POST");
}
}
stop();
-
up to my .as in code
but1.onPress=function(evt){
//If either of these two are empty....
if (first.text == "" || last.text == "") {
//Send our message clip ("theresult" ) timeline forward and send a message to the textfield (it resets itself) and let them know a field is empty
theresult.gotoAndPlay("go");
theresult.myresult.text = "Empty Fields";
If both fields are filled in....
} else {
//create a new loadVars to recieve reply from sendAndLoad
var result_lv= new LoadVars();
result_lv.onLoad = function(success) {
//if sendAndLoad functioned correctly, I will do.....
if (success) {
first.text="";
last.text="";//clear the textfields
// Send the message clip forward and send the variable "returnMe" sent from backside to the textfield
theresult.gotoAndPlay("go");
theresult.myresult.text = result_lv.returnMe;
//if sendAndLoad failed.....
} else {
//Send message clip forward and inform
theresult.gotoAndPlay("go");
theresult.myresult.text = "Error";
}
};
//create new loadVars to send our POST data and define the "result_lv" loadVars as the receiver
var send_lv = new LoadVars();
//each highlight in the lines below shows a variable name that has a matching $_POST[""]; in the php backside
send_lv.action = "send";
send_lv.first = first.text;
send_lv.last = last.text;
//send it all and define "result_lv" as the container
send_lv.sendAndLoad("mymailform.php", result_lv, "POST");
}
}
//I suck at explanations
stop();
Last edited by Chris_Seahorn; 01-07-2006 at 06:05 AM.
-
No, you don't suck at it. That is an excellent explaination.
I think where some of my confusion was coming in was with parameters such as (success) and (evt). I couldn't figure out if these were keywords or something that you put in to signify signify something OR if they are actually a parameter name.
Also, in the gotoAndPlay statement. I have used this myself but then I see your code and it threw me for a loop. gotoAndPlay("go")... I was like, Hmm? What frame is named go? Is go another general parameter? To me, (now) it seems like it means "go on to the next step in the code, not go to a specific frame".
-
up to my .as in code
Nope, there is a frame labeled "go".
-
Ok, then...now I'm confused again. I'm looking at the fun file right now and can't find a frame that's got ANY name.
When I list the frames is says
Keyframes:
1
2
-
up to my .as in code
if you open my loadVars mailform download and look at the timeline for the clip named "theresult" you will see frame one labeled "start" and frame 3 labeled "go"
Last edited by Chris_Seahorn; 01-07-2006 at 02:07 PM.
-
man alive...there is a lot of hidden stuff.
I thought that was a simple textbox named myresult...I guess I've got some changes to make to my form. LOL.
BTW. Kiosk is still down. Says Data Loading still. 1.4
-
up to my .as in code
Yeah...the security sandbox is kicking my a%%. The website is back up now that testing is done.
The next kiosks will be all self contained and not attempt to connect. I'm going to embed Firebird mini databases inside of them with clickable source code.
I have about a million kiosk ideas so it's gonna be a constant section at my site. All of them are created with SWFkit Pro.
The post I just made about created html kind of has all my attention right now. I'm testing both OBEDIT and *****'s Flasharea as the flash editor for Feedstar and it looks like ***** wins the prize because his component is skinnable, xml controlled and puts out cleaner html code and just a whole slew of other reasons.
-
up to my .as in code
Hey dniezby, when I made that loadVars download...it was only (at that time)downloadable via kiosk because the mode flag was on at my site for a week.....how did you get it if the kiosk didn't connect?
I remember chacking the logs and seeing a few downloads so some got in fine. I assumed one was you at the time.
Last edited by Chris_Seahorn; 01-07-2006 at 02:18 PM.
-
I downloaded it through your Kiosk when you first put it up.
-
up to my .as in code
dude...i think you just helped me out ( I rarely get feedback). Hahaha....thanks. It's the last bit of code I added recently buggering it up. Sweet.
I owe you one.
-
up to my .as in code
I exported a new version to see if the kiosk connects like it did when you downloaded Dniezby.
Does?
the windows menu buttons work (links)
it allow you to connect and download
-
up to my .as in code
I got your pm Dniezby. Was that connect with the latest version at my site?
I plan on embedding source code that will automatically fire Koolmoves when clicked from the kiosks so it's important. Like the "changelog" link is in there, these are not called from my website but are called from the EXE. I can embed an example using source code and show you what I mean if you want.
Last edited by Chris_Seahorn; 01-07-2006 at 03:18 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|