Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-25-2001, 12:34 AM   #1
oleung
Registered User
 
Join Date: May 2001
Posts: 4
Default

Having refer to web site like http://www.flashcfm.com

It seems easy to pass data from coldfusion to flash. But other than post the data to the dynamic text box. Can we use the data that pass from coldfusion to do other thing such as doing calculation or process under actionscripts. I am very frustrate on this.

Having use
loadVariablesNum ("#", 0); in flash to import data. I can't process the field data within action scripts. Can anyone give me help?

Can anyone show me how loadVariablesNum action works? Cause I can't get any help from Flash's actionscripts online help?

Thanks in advance.

Oliver
oleung is offline   Reply With Quote
Old 05-25-2001, 06:11 AM   #2
Jesse
ActionScript.org Founder
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: New York
Posts: 8,736
Default

The variables are loaded in as strings by default. So 5 is loaded in as "5" and you can't perform math actions on strings. Assuming you load a variable 'num1' whose loaded value ends up as "5" and another, 'num2' whose loaded value is "24" you can then perform math operations using:

total = Number(num1) + Number(num2)

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 05-25-2001, 06:39 AM   #3
oleung
Registered User
 
Join Date: May 2001
Posts: 4
Default Not so simple......

Thanks.

But it seems not so simple.

What happen to string? Say there is a field named "FirstName" and "LastName". Can I use add '+' operator to combined it like :

FullName = FirstName + " " + LastName;

I read from the tutorial that variable is typeless. So it suppose can convert to the corresponding type whenever necessary.

It seems I can only pop the field to the dynamic text box and can't make use of these fields on other process and calculation. No matter string or number.

Oliver
oleung is offline   Reply With Quote
Old 05-25-2001, 06:43 AM   #4
Jesse
ActionScript.org Founder
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: New York
Posts: 8,736
Default

Variables in Flash aren't typeless...

The code you gave should work fine:

first = "Jesse"
second = "Startford"

full = first + " " + second

Note that loadVariables is asyncrnous though so you have to wait for the variables to be loaded before you can perform operations on them.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 05-25-2001, 07:36 AM   #5
oleung
Registered User
 
Join Date: May 2001
Posts: 4
Default Still want to ask

You say we have to wait for the variables to be loaded before I can perform operations on them. How long does it takes? How can I assure the variables has been loaded?

For Example:

loadVariablesNum ("#", 0);

//first and second are field name from table
namefull = frist + " " + second


Above code tries to combine first and second together and assign to namefull variable. Then, I have a dynamic text box on the movie which point to namefull. Should this work?

If it should, then I don't know what I have done wrong.

See if you can help me on this. Thanks.

Oliver







oleung is offline   Reply With Quote
Old 05-25-2001, 07:56 AM   #6
Jesse
ActionScript.org Founder
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: New York
Posts: 8,736
Default

The best idea is to make all your queries return an extra variable as well as the variables you want. So if they return:

&first=Jesse&second=Stratford

make them also return a standard last variable, loaded=true

&first=Jesse&second=Stratford&loaded=true

Then you can run a loop which tests the loaded variable:

onClipEvent (enterFrame) {
if (_root.loaded != null) {
// vars are loaded
} else {
// not yet loaded
}
}

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 05-25-2001, 08:22 AM   #7
oleung
Registered User
 
Join Date: May 2001
Posts: 4
Default

Do you mean I should loop a function from the action script. I will try. Thanks.

Oliver




Then you can run a loop which tests the loaded variable:

onClipEvent (enterFrame) {
if (_root.loaded != null) {
// vars are loaded
} else {
// not yet loaded
}
}

Cheers
oleung is offline   Reply With Quote
Old 05-25-2001, 10:02 AM   #8
Jesse
ActionScript.org Founder
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: New York
Posts: 8,736
Default

onClipEvent (enterFrame) actions are run every time a frame is run. So they are aeffectively a loop. If your frame rate is 12 fps, they will be run 12 times per second.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Action Script Help Needed! - Simple, fun, RPG Shopping Cart... N!KtheAL!EN ActionScript 1.0 (and below) 5 01-28-2005 08:13 AM
Why does my simple actionscript make my simple tween fail? CodeNRun Animation and Effects 4 08-11-2004 12:49 PM
Just... simple... text ChyChsco Simple Stuff (Newbies) 1 06-10-2004 05:40 PM
Is there no simple answere? to Load movies hhhhhhh ActionScript 1.0 (and below) 1 06-22-2003 04:28 AM
simple simple down state button question Pixel ActionScript 1.0 (and below) 3 11-23-2001 03:49 PM


All times are GMT. The time now is 07:23 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.