dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Trying to split my map into a seperate .as

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    18

    Trying to split my map into a seperate .as

    I must be doing something wrong it is not working.

    in my map1.as I have

    Code:
    	public class Map1 extends Object3D
    	{
    		//load skins for planets
    		[embed(source="sunmap.jpg")]
    		private var sunskin:BitmapFileMaterial;
    
    		private var sun:Sphere;
    
    		public function Map1()
    		{
    		sunskin = new BitmapFileMaterial("sunmap.jpg");
    		sun = new Sphere({material:sunskin, radius:6955, segmentsH:16, segmentsW:16});
                    }
             }
    then in the main game.as I have
    Code:
    	public class Game extends Sprite
    	{
    		private var map:Map1;
    		private var view:View3D;
    		private var cam:Camera3D;
    		
    		public function Game()
    		{
    			view = new View3D();
    			cam = new Camera3D();
    			addChild(view);
    			view.camera = cam;
    			cam.z = 10000;
    			
    			map = new Map1();
    			view.scene.addChild(map);
    			view.render();
    		}
    	}
    I am using Away3D engine

    I get no errors but I also just have a blank screen. Any help appreciated.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    I'm not terribly familar with Away3D, but you are using embed incorrectly.

    Code:
    	public class Map1 extends Object3D
    	{
    		//load skins for planets
    		[Embed(source="sunmap.jpg")]
                    private var SunMap:Class;
    
    		private var sunskin:BitmapFileMaterial;
    
    		private var sun:Sphere;
    
    		public function Map1()
    		{
    		sunskin = new BitmapFileMaterial(new SunMap());
    		sun = new Sphere({material:sunskin, radius:6955, segmentsH:16, segmentsW:16});
                    }
             }

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    18
    actually I am not, the embed line doesnt even need to be in there I should remove it. BitmapFileMaterial in away3d loads it directly from a url without it being embeded.

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