Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling actionscript problems

Status
Not open for further replies.

mariebmk

Programmer
Jun 26, 2003
52
US
I'm going insane with an external actionscript file I've written. I'm trying to create dynamic forms and so have writen functions to add text fields, move components, etc to create the form layout. Sometimes it just doesn't seem to call the functions right. For example I have

currentForm.addFormText(movieLevel, "riskFactors2", "Additional Risk Factors", 50, addYSmall, myFontBold);

which just adds a textfield named "riskFactors2", with text "Additional Risk Factors" at an X coordinate of 50 and adds addYSmall after it as a spacer. This works great. Right below that i have the same function call within a loop.

for (i = 0; i < 10; i++){
if (risk_rs[5].getItemAt(i).pk_newRiskFactors < 6)
{
currentForm.addFormText(movieLevel, "risk" + i, risk_rs[5].getItemAt(i).DisplayNewRiskFactors, 15, addYSmall, myFontNormal);
}
}

which just compares data from the database (pk_newRiskFactor is the primary key, and DisplayNewRiskFactor) is the text, and displays it if the primary key is less than 6. This does not display anything, yet I know the function is called because the space for the text appears, just no text. I've had similar issues that calling functions work great until I put it in a loop of some sort.

Any ideas? I"ve been going insane here :)

Thanks

Beth
 
You might be trying to use the info before the DB transaction has taken place, so you might need to wait until the trasaction has taken place and then use it. (Just a thought).

Try using
Code:
for(var i = 0; i < 10; i++)
... I had the stragest behaviour for months because flash was getting confused because of the lack of the "var" (especially if you have used the variable "i" elsewhere...)
 
Can you post the code you are using to load the information from you DB? Berris is right it is likely a timing issue and would be easily fixed with an Event Listener.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top