its a setter... sorry for the typo.
>> ap.pathToSources("/stuff/otherstuff/myimages/");
should be ap.pathToSources = "/stuff/otherstuff/myimages/";
/**
* Allows to set custom path to source(s) map(s) other than set
in file
* Standard output url from Prefab awd files is
"images/filename.jpg"
* when set pathToSources, url becomes [newurl]filename.jpg.
* Example: AWData.pathToSources = "mydisc/myfiles/";
* Only required for load method using Loader3D
* var awd:AWData = new AWData();
* awd.pathToSources = "mydisc/myfiles/";
* loader = new Loader3D();
* loader.addEventListener(Loader3DEvent.LOAD_SUCCESS,
onSuccess);
* loader.loadGeometry("mymodels/car.awd", awd);
*
*/
public function set pathToSources(url:String):void
{
customPath = url;
}
Fabrice
On Jun 26, 2010, at 9:22 PM, Th3Sh33p wrote:
> Thanks for quick reply Fabrice,
>
> After modifying my script like so...
>
> var model_number:int = 0
> var model:String = "tree";
> var ld:Loader3D = new Loader3D()
> ld.addEventListener(Loader3DEvent.LOAD_SUCCESS,model_loaded);
> ld.addEventListener(Loader3DEvent.LOAD_ERROR,model_errored);
> ld.name = String(model_number);
> var ap:AWData = new AWData()
> ap.pathToSources("unit/"+model+"/"+model+"/images")
> ld.loadGeometry("unit/"+model+"/"+model+".awd",ap);
> private function model_loaded(e:Loader3DEvent){
> constructed[Number(e.target.name)] = e.target.handle
> }
>
> I get the error
>
> Line 29 1061: Call to a possibly undefined method pathToSources
> through a reference with static type away3dlite.loaders:AWData.
>
> Is this possible in away3dlite?
>
>
> On Jun 26, 3:07 pm, Fabrice3D <[email protected]> wrote:
>> Prefab resolves urls and also unescape them.
>> just open bitmapFilematerial and add a trace where the url is passed to load
>> the image.
>> you probably will get hints there.
>>
>> note that you also can pass a custom path to AWData parser for your images
>> directory as well.
>>
>> like var ap:AWData = new AWData();
>> ap.pathToSources("/stuff/otherstuff/myimages/");
>>
>> you also can add to init object of the AWData instance like this if you use
>> the parse handler for embedded awd files
>> var ap:AWData = new AWData({customPath:"/stuff/otherstuff/myimages/"});
>>
>> Fabrice
>>
>> On Jun 26, 2010, at 7:37 PM, Th3Sh33p wrote:
>>
>>
>>
>>> I created a tree model, which I would like to place in my project, it
>>> was created as a obj file, imported into prefab, then a texture was
>>> added and I exported as a awd file. Then I used this script...
>>
>>> var model_number:int = 0
>>> var model:String = "tree";
>>> var ld:Loader3D = new Loader3D()
>>> ld.addEventListener(Loader3DEvent.LOAD_SUCCESS,model_loaded);
>>> ld.addEventListener(Loader3DEvent.LOAD_ERROR,model_errored);
>>> ld.name = String(model_number);
>>> var ap:AWData = new AWData()
>>> ld.loadGeometry("unit/"+model+"/"+model+".awd",ap);
>>
>>> private function model_loaded(e:Loader3DEvent){
>>> constructed[Number(e.target.name)] = e.target.handle
>>> }
>>> .. to import the model, which was successful, however the model has no
>>> material or texture. I have tried various things I've seen on other
>>> threads but the model is always white when imported.The folder
>>> "images" is located next to "tree.awd".
>>
>>> How can I import this model with it's material?
>>
>>> *The model imports successfully with textures back into prefab