A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: easy one... I'm still having trouble with paths

  1. #1
    Member
    Join Date
    Apr 2003
    Location
    LA, CA
    Posts
    36

    easy one... I'm still having trouble with paths

    Just when I think I have a handle on understanding path naming, I run into problems. At least I think that's the problem... I've got similar AS code working fine in another movie, but the path situation there is different.

    The problem is in the last chunk of code below, after the "// fill in numbers" comment. The section before that (which draws a grid) works fine.

    I'm grabbing some info from a database via PHP, drawing a grid, and then trying to number the appropriate boxes of the grid. "numbox" is my MC with a dynamic text box, which is repeatedly duplicated for holding each number. I have it "exported for ActionScript," so that's not the problem.

    The numbers just don't appear when I run it. I'd like to keep all these numbers within the "grid" MC that's created, but maybe I've got it set up wrong.

    Code:
    stop();
    var numCols = Number(numchosen);
    var numVlines = numCols + 1;
    var classid = Number(classid);
    
    _root.choices = new Array (_root.numCols);
    var varSender:LoadVars = new LoadVars();
    varSender.classid = classid;
    varSender.numchosen = numchosen;
    for (var i = 0; i < _root.numCols; i++) {
    		_root.choices[i] = this["choice"+i];
    		varSender["choice"+i] = this["choice"+i];
    }
    
    // create an object to store the variables
    varReceiver = new LoadVars();
    // load the variables from the text file
    varSender.sendAndLoad("fetchsyldata.php", varReceiver, "GET");
    // trigger fn. when the variables finish loading 
    varReceiver.onLoad = function(){
    	var numRows = Number(this.totalrows);
    	var startX = 407 - (numCols * 67.5);
    	var lineHeight = numRows * 50;
    	// draw grid
    	_root.createEmptyMovieClip("grid", 1);
    	with(_root.grid) {
    		for (var i = 0; i < numVlines; i++) {
    			var lineX = startX + (i*135);
    			lineStyle(1, 0xFFFFFF, 100);
    			moveTo(lineX, 0);
    			lineTo(lineX, lineHeight);
    		}
    		for (var i = 0; i < numRows; i++) {
    			lineStyle(1, 0xFFFFFF, 100);
    			moveTo(startX-2, (i+1)*50);
    			lineTo(startX+(numCols*135)+2, (i+1)*50);
    		}
    
    		// fill in numbers
    		for (var i = 0; i < numCols; i++) {
    			var numLectures = Number(this["rowsincol"+i]);
    			_root.chosenTxt.text = numLectures;
                              // (for troubleshooting... "numLectures" is displayed 
                                  correctly, so this variable is correct)
    			for (var x = 0; x < numLectures; x++) {
    				var boxNum = i*100 + x;
    				this.attachMovie("numbox", "numbox"+boxNum, 1);
    				this["numbox"+boxNum]._x = startX + (i*135);
    				this["numbox"+boxNum]._y = (x+1)*50;
    				this["numbox"+boxNum].numBoxText.text = x;
    			}
    		}
    	}	
    }

  2. #2
    Member
    Join Date
    Apr 2003
    Location
    LA, CA
    Posts
    36
    I'm still playing with this, without luck.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    To test you application, the fetchsyldata.php that you load, would be required. Also one would have to re-build your flash document. You get more chances of being helped if you post the files.

    gapris

  4. #4
    Member
    Join Date
    Apr 2003
    Location
    LA, CA
    Posts
    36
    Ah, I see. Thanks, and sorry about that. I thought that if I had a path error that was easily spotted, I'd save anyone the trouble of actually running anything.

    The HTML page containing my SWF is reached by a link that passes some variables, which are then passed to Flash and then to the PHP, to get the database info. For someone to test this, wouldn't they have to get that all interconnected, as well as have access to my database? I'd feel bad for putting anyone through that for what's likely some stupid mistake I'm overlooking. I'm going to keep at it for a while more. Thanks for the reply... I'm glad to learn the etiquette here.

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    maybe:
    code:
    myLoadVars.onLoad = function(success)
    if(success) //etc.


    would be better.

    gparis
    Last edited by gparis; 10-08-2004 at 03:00 PM.

  6. #6
    Member
    Join Date
    Apr 2003
    Location
    LA, CA
    Posts
    36
    Thanks again. That didn't change anything, unfortunately.

    But it got me to notice something... the status bar at the bottom of the browser window constantly says "Transferring data from...", even though the data has (supposedly) already been successfully loaded from my PHP script. I checked "varReceiver.loaded" within my varReceiver.onLoad function, and it's "true." So why would the browser still be saying it's transferring data? I can't imagine why. Hmmmmmm.

  7. #7
    Member
    Join Date
    Apr 2003
    Location
    LA, CA
    Posts
    36
    got it! Actually, I think I had it a long time ago, but I didn't realize it, and I changed it back... that'll teach me to forget about my browser caching. doh!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center