Author Topic: load f3d  (Read 440 times)

Daimon Fox   «   on: March 06, 2012, 06:31:18 AM »
Hi, trying to make to load f3d files using XML

help with code
var data:XML in xml.children() ???
model = scene.addChildFromFile( "../resources/model_folder"???

(data.@x / texWidth, data.@y / texHeight, data.@width / texWidth,  data.@height / texHeight );
 
 
 private var xml:XML =
      <data>
         <sprite id = "fire.f3d" x = "100" y = "250" width = "50" height = "40"/>
         <sprite id = "water.f3d" x = "150" y = "200" width = "10" height = "20"/>
         <sprite id = "ice.f3d" x = "300" y = "435" width = "25" height = "30"/>
      </data>    

Ivan Vodopiviz   «   Reply #1 on: March 07, 2012, 11:01:13 AM »
Hi,

Could you please post the full example and why it isn't working?

Sam Chau   «   Reply #2 on: March 07, 2012, 12:41:07 PM »
Try something like:

var xml : XML = data as XML;
var basePath : String = "../resources/model_folder/";
for each (var node : XML in xml.sprite)
{
    var path : String = basePath.concat(node.@id);
    scene.addChildFromFile(path);
}

Daimon Fox   «   Reply #3 on: March 07, 2012, 01:26:39 PM »
Unfortunately I do not have when :( 
The task is to create a loading and placement of individual objects in a scene
the coordinates x,y,z,

Ivan Vodopiviz   «   Reply #4 on: March 07, 2012, 01:54:36 PM »
Please check Sam's post. Adding positioning to his code should be as simple as this:

for each (var node : XML in xml.sprite)
{
    var path : String = basePath.concat(node.@id);
    var object:Pivot3D = scene.addChildFromFile(path);
    object.setPosition(node.@x, node.@y, node.@z);
}

Hope this helps,

Daimon Fox   «   Reply #5 on: March 07, 2012, 04:41:26 PM »
Ivan thx. but it gives an error    1120: Access of undefined property data.





Ivan Vodopiviz   «   Reply #6 on: March 07, 2012, 04:48:47 PM »
Well, if you just copied my code it will probably fail because you don't have a "z" value in you XML, sorry about that.

Daimon Fox   «   Reply #7 on: March 08, 2012, 02:48:44 AM »
Thank you Ivan for your help! You helped me solve my problem.

p.s. I do not regret my transition with Alternativa3d on Flare3D.

Ivan Vodopiviz   «   Reply #8 on: March 08, 2012, 04:26:53 AM »
Glad to hear that! :)

Sam Chau   «   Reply #9 on: March 01, 2012, 11:43:16 AM »
Doh! Missed my chance at taking full credit! :P

Daimon Fox   «   Reply #10 on: March 09, 2012, 02:32:58 PM »
Hey Ivan need help
 wanted to make a balloon tip when pointing to an object as http://www.flare3d.com/demos/web/
 I need to name the object in xml => something like this - node.@name??

for each (var node : XML in xml.sprite)
{
    var path : String = basePath.concat(node.@id);
    var object:Pivot3D = scene.addChildFromFile(path);
    object.setPosition(node.@x, node.@y, node.@z);
}

Ivan Vodopiviz   «   Reply #11 on: March 09, 2012, 02:49:05 PM »
That's one way to do it, yes. Actually, you can put whatever you need in the XML :)

Daimon Fox   «   Reply #12 on: March 09, 2012, 03:10:38 PM »
but when I write
object.setPosition(node.@x, node.@y, node.@z, node.@name);

but the function setPosition for-xyz is not for the name

Daimon Fox   «   Reply #13 on: March 09, 2012, 05:23:13 PM »
up

Ivan Vodopiviz   «   Reply #14 on: March 09, 2012, 05:49:33 PM »
Hmm... it seems I didn't understand you question.

What do you want to store in node.@name? Why would you pass it as parameter to setPosition?