[Resolved] text from XML with movieMaterial : problem

Software: Away3D 3.x

Erroll, Newbie
Posted: 27 August 2011 08:01 PM   Total Posts: 6

Hi,
i’m trying to load some text from XML, the ‘trace’ is correct, but the text doesn’t show up on screen. I created a movieMaterial, with a textField into it, and if i test the code with a random text it works, but not with my text from the XML. Do you know why? i’m a bit stuck ... Thanks for your help

mc = new MovieClip();
        
textfield = new TextField();
  
textfield.setTextFormat(new TextFormat("Arial"500xff0000));
  
  
//load xml
  
myXMLLoader = new URLLoader();
  
myXMLLoader.load(new URLRequest("texteXML/texte.xml"));
  
myXMLLoader.addEventListener(Event.COMPLETEprocessXMLduTexte);
  
  
//textfield.text = "allodsqkjflmsdjfmlqsjdflmqkdjflmdkj";
        
textfield.autoSize "left";
        
mc.addChild(textfield);
                
        var 
text_movie Plane = new Plane({width:TEXT_WIDTHheight:TEXT_HEIGHT});
                
text_movie.material = new MovieMaterial(mc);
                
text_movie.bothsides true;
                
text_movie.rotationX 90;
                
view.scene.addChild(text_movie);
      
}
   
   
function processXMLduTexte(e:Event):void {
      
//load text from xml
   
var myXML:XML = new XML(e.target.data);
   var 
my_texts:XMLList myXML.elements("titre");
   
   
//show text from xml
   
textfield.text myXML.titre[0].@nom;
   
trace (myXML.titre[0].@nom);
  
   
myXMLLoader.removeEventListener(Event.COMPLETEprocessXMLduTexte);
   
myXMLLoader null;
  
  
   

Avatar
theMightyAtom, Sr. Member
Posted: 27 August 2011 08:35 PM   Total Posts: 669   [ # 1 ]

If you add the mc to the stage, does it look right?
Looks to me like you’re assigning the mc to the material before the text has been drawn.

Try text_movie.material.update() after you’ve assigned the text to the textfield.

Good Luck!

 

   

Erroll, Newbie
Posted: 27 August 2011 09:37 PM   Total Posts: 6   [ # 2 ]

thanks for the answer, yes the mc appears on screen,
i tried your line with “update” but i’ve got an error 1061 : undefined method with type : away3D.materials:Material, i tried to import the whole away3d.materials.* but still the same error….

any other idea? i really don’t know what to do.

   

Avatar
theMightyAtom, Sr. Member
Posted: 28 August 2011 08:02 AM   Total Posts: 669   [ # 3 ]

(text_movie.material as MovieMaterial).update();

   

Erroll, Newbie
Posted: 28 August 2011 01:38 PM   Total Posts: 6   [ # 4 ]

thanks wink it did not work, but it’s a good tip to know. I actually moved the code with the text and movieMaterial after loading the XML, and it works fine. Thanks a lot anyway wink if you have any idea about the simpleShadow (in my other topic) your help would be also appreciated! thanks again

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X