Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-25-2012, 07:34 PM   #1
Registered User
Join Date: Jan 2012
Posts: 5
Default [AS2] Problem Understanding why not working

hello everyone i have this project i am working on it isnt for school or anything its just a hobby thing but i would love to find out what i am doing wrong here
so here is my code

ActionScript Code:
//////////////////////////////////////////////////////// //////////////////// ISO GAME ////////////////////////// ///////////////// BY D'n'C GameZ /////////////////////// /////////////// 2/22/2012 2:45 pm ////////////////////// //////////////// ActionScript 2.0 ////////////////////// //////////////////////////////////////////////////////// //////////////////////////////////////////////////////// ////////////////////// LOADS /////////////////////////// //////////////////////////////////////////////////////// mapHolder= new LoadVars(); mapHolder.onLoad = mapLoad; mapHolder.load("maps.txt"); //////////////////////////////////////////////////////// /////////////////////// MAPS /////////////////////////// //////////////////////////////////////////////////////// function mapLoad(){     gameMap = mapHolder.Map001;     trace(gameMap); /* trace does work but the     tiles for the map dont show up at all that     is what i need help on to get it working     right and displaying my map */ }; //////////////////////////////////////////////////////// /////////////////////// TILES ////////////////////////// //////////////////////////////////////////////////////// game={tileW:45}; game.TileClass= function(){}; game.TileClass.prototype.clickable=false; game.TileClass.prototype.frame=100; game.Tile0= function(){}; game.Tile0.prototype.__proto__=game.TileClass.prototype; game.Tile0.prototype.clickable=true; game.Tile0.prototype.frame=1; ///////////////////////////////////////////////////////// /////////////////////// FUNCTIONS /////////////////////// ///////////////////////////////////////////////////////// function buildMap(map){     _root.attachMovie("empty","tiles",++d);     game.clip=_root.tiles;     var mapWidth = map[0].length;     var mapHeight = map.length;     for(var i=0;i < mapHeight; ++i){         for(var j=0;j <mapWidth; ++j){             var name = "t_"+i+"_"+j;             game[name]= new game["Tile"+map[i][j]];             game.clip.attachMovie("tile", name, i*100+j*2);             game.clip[name]._x = (j-i)*game.tileW;             game.clip[name]._y = (j+i)*game.tileW/2;             game.clip[name].gotoAndStop(game[name].frame);             game[name].depth=(j+i)*game.tileW/2*300+(j-i)*game.tileW+1;         }     } } ////////////////////////////////////////////////////////// ///////////////////// INITIALIZE ///////////////////////// //////////////////////////////////////////////////////////                     buildMap(gameMap);//comand to set map up                                         ////////////////////////////////////////////////////////// //////////////////// INSIDE TEXT FILE //////////////////// ///////////////// TEXT FILE NAME maps.txt //////////////// ////////////////////////////////////////////////////////// /* Map001=[[0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0],         [0,0,0,0,0,0,0,0,0,0]         ]; */ ////////////////////////////////////////////////////////// ////////////////// FAST OBJECT SETUP ///////////////////// ////////////////////////////////////////////////////////// /* in order for this to work you need to make 2 movieclips  movieclip 1 name(whatever you want) export for actionscript  identifier name as (empty)  movieclip 2 name(whatever you want) export for actionscript  identifier name as (tile)    and draw a tile in the tiles moviclip  */

any help on understanding this would be great thanks

Last edited by V_D_Gamez; 02-25-2012 at 07:47 PM.
V_D_Gamez is offline   Reply With Quote
Old 02-27-2012, 09:12 PM   #2
throw a trace() in there
Join Date: Dec 2006
Posts: 1,982

Put your call to buildMap inside your mapLoad function. What's happening is you're calling buildMap before mapHolder is finished loading so gameMap is empty.
rrh is offline   Reply With Quote

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 On
HTML code is Off

Forum Jump

All times are GMT. The time now is 11:17 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.