SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with loadvariables() problem, I think is timing but not sure

    I'm trying to use my loaded variable "finalCount" from php in my flash "for loop", but it doesnt work. I have my code sitting in the root, frame 1. I have a dynamic text field on the stage, with the variable name finalCount, and it loads and display the variable perfectly. But still I cannot use the variable finalCountNum in the for loop.

    My code is as follow:
    Code:
    // Load variables from PHP script
    loadVariables("map3.php", this);
    
    // Turn variables from strings into numbers
    var finalCountNum = Number(finalCount);
    
    // Set variables for stage text-box
    stageFinalCount = finalCountNum;
    
    // Control variables
    xpos 	= 5;
    ypos 	= 5;
    yspace 	= 5;
    
    // Duplicate the dots and place them apart on the X & Y axis
    for (i=1; i<=finalCountNum; i++) {
    	dot.duplicateMovieClip("dot"+i, i);
    	this["dot"+i]._x = xpos;
    	this["dot"+i]._y = ypos;
    	ypos += yspace;
    }
    
    
    stop();
    My second question: How do I declare this if statement correctly? What I'm code is, if finalCount variable is not set or is empty, then finalCount = 20.
    To see more on where I'm using this code, please reffer to the code above this one.
    Code:
    // if finalCountNum variable empty	
    if (!finalCountNum) {
    	finalCountNum= 20;
    }
    Thank you!
    Last edited by ARSA; May 4, 2005 at 22:15.
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  2. #2
    SitePoint Wizard jim_morrison3's Avatar
    Join Date
    Apr 2004
    Location
    UK
    Posts
    2,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I'm trying to use my loaded variable "finalCount" from php in my flash "for loop", but it doesnt work.
    Hi,
    You can access your PHP variables in Flash by using _root convention like _root.finalCount, if your Flash is embedded in the PHP page.

    My second question: How do I declare this if statement correctly? What I'm code is, if finalCount variable is not set or is empty, then finalCount = 20.
    If finalCount is a number then you can use the following:

    if(finalCountNum==0){
    finalCountNum=20
    }
    Good Luck!
    There are things known and Things unknown
    And in between are the Doors.
    I love hand Coding.

  3. #3
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    question#1:
    I don't think the swf is embeded to the php page, because I didn't setup any new parameters for the swf html tag... and the swf is not in the same page as the script because of the "echo" problem, that displays the variables to screen and stuff.

    question#2:
    Well, yes its supposed to be a number, but since I don't get my php variable to work, I cannot see whats happening at the moment with that part of the code.

    thanks for your reply
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  4. #4
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    This are the files I'm working with at the momment.
    Attached Files Attached Files
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  5. #5
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody?
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein

  6. #6
    SitePoint Addict ARSA's Avatar
    Join Date
    Apr 2003
    Location
    San Juan, Puerto Rico
    Posts
    215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RESOLVED :: The way to fix this problem is by separating the the script in the main key line. I'm using 10 frames to do so...
    "I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." - Albert Einstein


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •