mercredi 10 mars 2010

FLAR, import troubleshooting

Sometimes the movie does not start showing an avalanche of errors which are not very understandable, like this:

error.jpg

It is clear that the movie does not find the right as files.

You can solve this by going to Publish settings->flash->actionscript settings and trying to add the files the movie needs. But then these path’s are hard coded.

The problem lies in the header of the as files: (PV3DARApp.as)

folder.jpg (image pv3d is situated in support folder)

Very important is the PV3DARApp.as file, situated in the same folder as your SimpleCube.as or SimplePlane.as.

This file is included in the FLAR files but can also be openend in FLASH.

In the header of the PV3DARApp.as file you can find these lines:

import org.libspark.flartoolkit.support.pv3d.FLARBaseNode;
import org.libspark.flartoolkit.support.pv3d.FLARCamera3D;

sometimes the lines are like this: (apperently there are two versions of this starter toolkit.)

import org.libspark.flartoolkit.pv3d.FLARBaseNode; //so without support
import org.libspark.flartoolkit.pv3d.FLARCamera3D;

so looking in the folder called org -> libspark -> then either you have directly pv3d or ->support-> pv3d (see image of folders)

Also apparently when the support folder is not used: you have to use _baseNode.addChild and when the support is installed _markerNode.addChild etc.

So the problem can be solved choosing the right import lines, without or with the support folder and using the right Node, _markerNode or _baseNode.

When you have sorted this out, you do not need the external path in action script settings, which avoids hard coding this path, which avoids problems when copying the movies to other locations, or to other laptops.

AVOID HARD CODED FILE PATH’s!!!!

Aucun commentaire:

Enregistrer un commentaire