A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: problems with grid

  1. #1
    Senior Member
    Join Date
    Mar 2005
    Posts
    154

    problems with grid

    Aii there...

    Okay I just make a grid based on array... my problem is how to highlight boxes that contain only character I mean if the box contain character it will gotoAndPlay(2)...eg:

    *****
    **C**
    *CAR*
    **T**
    *****

    here's the code currently Im using...

    Code:
    var xPos:Number = 10;
    var yPos:Number = 10;
    var columns:Array = new Array(["*","*","*","*","*"],["*","*","c","*","*"],["*","c","a","r","*"],["*","*","t","*","*"],["*","*","*","*","*"]);
    for (var i:Number = 0; i < columns.length; i++) {
        for (var j:Number = 0; j < columns[i].length; j++) {
            //if (columns[i][j]) {
                var s:MovieClip = this.attachMovie("square", "square" + this.getNextHighestDepth(), this.getNextHighestDepth());
                s._x = xPos;
                s._y = yPos;
                s.lbltxt.text = columns[i][j];
            //}
            xPos += 20;
        }
        yPos += 20;
        xPos = 10;
    }
    Hope someone will give me shed some light....thanks

  2. #2
    Flashmatics silentweed's Avatar
    Join Date
    Mar 2005
    Location
    London, UK
    Posts
    4,876
    PHP Code:
    var xPos:Number 10;
    var 
    yPos:Number 10;
    var 
    columns:Array = new Array(["f","*","*","*","*"],["*","*","c","*","*"],["*","c","a","r","*"],["*","*","t","*","*"],["*","*","*","*","*"]);
    for (var 
    i:Number 0columns.lengthi++) {
        for (var 
    j:Number 0columns[i].lengthj++) {
            
                var 
    s:MovieClip this.attachMovie("square""square" this.getNextHighestDepth(), this.getNextHighestDepth());
                
    s._x xPos;
                
    s._y yPos;
                
    s.lbltxt.text columns[i][j];
                if(
    columns[i][j] != "*"
                {
                    
    s.gotoAndStop(2);
                }
                
    xPos += 20;
        }
        
    yPos += 20;
        
    xPos 10;

    Flashmatics | Flashmatics Library (free downloads)
    -----------------------------------------------------
    Latest Projects:
    The Dead Room | Are You Smarter | Prison Break (Frame A Friend) | Beck's Fusions | The 24 Experience

    -----------------------------------------------------
    Flash Certified Developer

  3. #3
    Senior Member
    Join Date
    Mar 2005
    Posts
    154
    Quote Originally Posted by silentweed
    PHP Code:
    var xPos:Number 10;
    var 
    yPos:Number 10;
    var 
    columns:Array = new Array(["f","*","*","*","*"],["*","*","c","*","*"],["*","c","a","r","*"],["*","*","t","*","*"],["*","*","*","*","*"]);
    for (var 
    i:Number 0columns.lengthi++) {
        for (var 
    j:Number 0columns[i].lengthj++) {
            
                var 
    s:MovieClip this.attachMovie("square""square" this.getNextHighestDepth(), this.getNextHighestDepth());
                
    s._x xPos;
                
    s._y yPos;
                
    s.lbltxt.text columns[i][j];
                if(
    columns[i][j] != "*"
                {
                    
    s.gotoAndStop(2);
                }
                
    xPos += 20;
        }
        
    yPos += 20;
        
    xPos 10;

    Thanks for the code silentweed....

    and ur concern....sorry for the lateness reply....

    Tq

  4. #4
    Senior Member
    Join Date
    Mar 2005
    Posts
    154
    Hi Silentweed

    1stly I ve been decide not to using static value array as I post previously on board regarding the crossword..so I just load from xml file.....and it workings now...and as for new with AS3 i manage to make a simple mockup crossword as Im still try and error with as3....ok here what I have now...

    http://www.franzacollections.net/fifin04/cw_as3.swf

    source


    http://www.franzacollections.net/fifin04/cw_as3.fla

    What I after is if someone has click the item in the list it will highlight the box that contain the words from the clue...eg; If I click item "just sport car" so the answer will be
    ferrari..then it will highlight the all box that contain ferrari words...is it something can be doone or maybe My whole code are wrongly structured at the 1st places..hope I will get any lead from u...or maybe something point me to the rite path..any help are really appreciated...u can take look my code in my fla attach...


    Tq for ur times mate...

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