Hi Rechard,
stage was null because I created a app type is Flex project. It didn't work.
stage was not null when I created a app with type is ActionScript Project.
--> It worked
This is stack error:
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at
HoverDragController()[D:\Working\Study\workspace\TestBroomStick\src\HoverDragController.as:41]
at
LoaderOBJTest()[D:\Working\Study\workspace\TestBroomStick\src\LoaderOBJTest.as:74]
at
Main/application1_creationCompleteHandler()[D:\Working\Study\workspace\TestBroomStick\src\Main.mxml:27]
at
Main/___Main_Application1_creationComplete()[D:\Working\Study\workspace\TestBroomStick\src\Main.mxml:4]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at
mx.core::UIComponent/dispatchEvent()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]
at mx.core::UIComponent/set
initialized()[E:\dev\hero_private\frameworks\projects\framework\src\mx\core\UIComponent.as:1818]
at
mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\LayoutManager.as:842]
at
mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\hero_private\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
the mxml file in my Flex project.
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="application1_creationCompleteHandler(event)"
minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.events.FlexEvent;
protected function
application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
var ui:UIComponent = new UIComponent();
var obj:LoaderOBJTest = new LoaderOBJTest();
addChild(ui);
ui.addChild(obj);
}
]]>
</fx:Script>
</s:Application>
I call LoaderOBJTest class in broomstick and stage was always null.
Regards,
D
On Thu, May 19, 2011 at 5:31 PM, richardolsson <[email protected]> wrote:
> You said you were getting an error regarding the Texture class not
> being found (indicating that you either are running in an old player
> or have compiled for an old SWF version, i.e. anything other than 13.)
> If you are not getting that error anymore, but something regarding to
> stage being null, can you please paste that error message?
>
> Are you generally familiar with AS3 development in Flash Builder, or
> whatever IDE you are using?
>
>
> Cheers
> /R
>
>
> On May 19, 10:55 am, Cong Danh Pham <[email protected]>
> wrote:
> > Hi,
> >
> > But when I build a AS3 project then it stage is not null and It worked.
> > How to call my class extends Sprite from mxml? as previous mail I showed
> my
> > way, but it seems that doesn't work.
> >
> > Please help?
> >
> > Regards,
> > D
> >
> > On Thu, May 19, 2011 at 3:03 PM, danhpc <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Yes, already. richard
> >
> > > I added that line to:
> >
> > > In Properties of my project/Flex Compiler and additional compiler
> > > arguments:
> > > -locale en_US -swf-version=13
> >
> > > But it doesn't work. I don't know. :((
> > > Regard
> > > D
> >
> > > On May 19, 2:51 pm, richardolsson <[email protected]> wrote:
> > > > Are you compiling with SWF version 13? Make sure you pass -swf-
> > > > version=13 as a mxmlc command line option.
> >
> > > > Cheers
> > > > /R
> >
> > > > On May 19, 9:41 am, danhpc <[email protected]> wrote:
> >
> > > > > Hi,
> >
> > > > > I tried setup again flash player 11 it cans run without error
> "Error
> > > > > #1014: Class flash.display3D.textures::Texture could not be found."
> > > > > but stage is always null ???
> > > > > my class extend Sprite
> > > > > I call my class from .mxml file by some line code as below:
> >
> > > > > protected function init():void
> > > > > {
> > > > > var ui:UIComponent = new UIComponent();
> > > > > var obj:Main = new Main();
> > > > > addChild(ui);
> > > > > ui.addChild(obj);
> > > > > }
> >
> > > > > public class Main extends Sprite
> > > > > {
> >
> > > > > public function Main()
> > > > > {
> > > > > // Setup our stage
> > > > > stage.scaleMode = StageScaleMode.NO_SCALE;
> > > > > stage.align = StageAlign.TOP_LEFT;
> > > > > addEventListener(Event.ADDED_TO_STAGE, init);
> >
> > > > > var s:Stage3D = new Stage3D();
> >
> > > > > }
> > > > > }
> >
> > > > > please help me? :(
> >
> > > > > regards,
> > > > > D
> >
> > > > > On May 19, 12:03 pm, danhpc <[email protected]> wrote:
> >
> > > > > > Hi Fabrice,
> >
> > > > > > I tried to away3D 4.0 but when I started my app. it's always show
> > > > > > error as below.
> > > > > > I have already installed Flex SDK4.5.0.19786, Adobe Flash Player
> 11,
> > > > > > check out broomstick and build my app successfully.
> > > > > > I create a project and add example in broomstick that was still
> the
> > > > > > same error.
> >
> > > > > > VerifyError: Error #1014: Class flash.display3D.textures::Texture
> > > > > > could not be found.
> >
> > > > > > Regards,
> > > > > > D
> >
> > > > > > On May 18, 4:20 pm, Fabrice3D <[email protected]> wrote:
> >
> > > > > > > no, I thought you were using to 4.0.
> >
> > > > > > > to parse your result handle,
> > > > > > > take a look at some classes in tools where you'll find
> recursive
> > > methods.
> >
> > > > > > > your test is limited to first level. take the case for instance
> > > where handle is a container and only child is a container with meshes
> > > inside.
> > > > > > > your loop will not access these, while its precisely the one
> you
> > > want in order to mod their materials.
> >
> > > > > > > Fabrice
> >
> > > > > > > On May 18, 2011, at 10:41 AM, danhpc wrote:
> >
> > > > > > > > I'm using Away3D 3.6 & Flash Player 10. Broomstick cans do
> this?
> > > > > > > > I see in the Obj.as file has the comments as below:
> >
> > > > > > > > /**
> > > > > > > > * File loader for the OBJ file format.<br/>
> > > > > > > > * <br/>
> > > > > > > > * note: Multiple objects support and autoload mtls are
> > > supported
> > > > > > > > since Away v 2.1.<br/>
> > > > > > > > * Class tested with the following 3D apps:<br/>
> > > > > > > > ....
> > > > > > > > * - geometry supported tags: f,v,vt, g<br/>
> > > > > > > > * - geometry unsupported tags:vn,ka, kd r g b, kd, ks r g
> > > b,ks,ke r g
> > > > > > > > b,ke,d alpha,d,tr alpha,tr,ns s,ns,illum
> > > n,illum,map_Ka,map_Bump<br/>
> > > > > > > > * - mtl unsupported tags: kd,ka,ks,ns,tr<br/>
> > > > > > > > * <br/>
> > > > > > > > * export from apps as polygon group or mesh as .obj
> file.<br/>
> > > > > > > > * added support for 3dmax negative vertexes references
> > > > > > > > */
> >
> > > > > > > > It seems the version 3.6 can't help, right?
> >
> > > > > > > > Regards,
> > > > > > > > danhpc
> >
> > > > > > > > On May 18, 3:09 pm, richardolsson <[email protected]>
> wrote:
> > > > > > > >> What version of Away3D are you using? Is this Broomstick
> (Flash
> > > Player
> > > > > > > >> 11, Away 4.0), or one of the older engine versions?
> >
> > > > > > > >> Cheers
> > > > > > > >> /R
> >
> > > > > > > >> On May 18, 5:59 am, danhpc <[email protected]>
> > > wrote:
> >
> > > > > > > >>> Sorry Michael for my typo. Correct your name.
> >
> > > > > > > >>> On May 18, 10:48 am, Cong Danh Pham <
> > > [email protected]>
> > > > > > > >>> wrote:
> >
> > > > > > > >>>> Thanks for your supports Michael and Fabrice.
> >
> > > > > > > >>>> I tried to load obj file. It cans appear but the color is
> > > still random?
> > > > > > > >>>> The attached files was exported from 3D Max.
> > > > > > > >>>> It seems that was lost name of object3d in away3d. ??? -->
> I
> > > need the name
> > > > > > > >>>> of these.
> > > > > > > >>>> khoi2.obj & khoi2.mtl is the same folder.
> >
> > > > > > > >>>> This is my code:
> > > > > > > >>>> loader = Obj.load("presentation/assets/khoi2.obj", {
> > > scaling:10,
> > > > > > > >>>> bothsides:true });
> > > > > > > >>>> loader.addOnSuccess(onSuccess);
> >
> > > > > > > >>>> private function onSuccess(event:Loader3DEvent):void
> > > > > > > >>>> {
> > > > > > > >>>> if (loader) {
> > > > > > > >>>> var objContainer3D:ObjectContainer3D
> =
> > > > > > > >>>> event.loader.handle as ObjectContainer3D;
> > > > > > > >>>> for (var
> > > i:int=objContainer3D.children.length-1; i>=0;)
> > > > > > > >>>> {
> > > > > > > >>>> // NAME IS NULL HERE
> > > > > > > >>>> //var meshObject:Mesh =
> >
> > >
> ObjectContainer3D(event.loader.handle).getChildByName(objContainer3D.childr
> > > en[i].name)
> > > > > > > >>>> as Mesh;
> >
> > > > > > > >>>> HOW TO GET ORIGINAL COLOR IN ".mtl file" TO SET TO THESE
> > > OBJECT3D?
> >
> > > group.addChild(objContainer3D.children[i]);
> > > > > > > >>>> i--;
> > > > > > > >>>> }
> > > > > > > >>>> }
> > > > > > > >>>> }
> >
> > > > > > > >>>> Regards,
> > > > > > > >>>> danhpc
> >
> > > > > > > >>>> On Tue, May 17, 2011 at 7:28 PM, Fabrice3D <
> > > [email protected]> wrote:
> > > > > > > >>>>> loading another file(.dae, .obj...) in away3d that cans
> show
> > > > > > > >>>>>> original color of object?
> >
> > > > > > > >>>>> ObjParser does support file based color objects.
> > > > > > > >>>>> The .mtl parser reads the following tags for color
> objects
> > > definitions:
> >
> > > > > > > >>>>> "Ka": ambientColor
> > > > > > > >>>>> "Ks": specularColor
> > > > > > > >>>>> "Ns": specular value
> > > > > > > >>>>> "Kd": diffuseColor
> > > > > > > >>>>> Transparency is supported by "tr": or "d" tags
> >
> > > > > > > >>>>> Fabrice
> >
> > > > > > > >>>>> On May 17, 2011, at 12:54 PM, Michael Iv wrote:
> >
> > > > > > > >>>>> In such a case I would suggest you a workaround. The
> > > simpliest is to append
> > > > > > > >>>>> to each model's file name a prefix or suffix holding the
> > > color value.Then
> > > > > > > >>>>> when loading the model you can read the file name and
> parse
> > > its
> > > > > > > >>>>> suffix/prefix to the color flag then using simple
> "swtich()"
> > > or "if" assign
> > > > > > > >>>>> the matching colors during the runtime. The more complex
> way
> > > is to hack the
> > > > > > > >>>>> exporter and parser .
> >
> > > > > > > >>>>> On Tue, May 17, 2011 at 1:49 PM, danhpc <
> > > [email protected]>wrote:
> >
> > > > > > > >>>>>> Thanks for your quickly answer.
> > > > > > > >>>>>> But I don't want to assign my own color to those object.
> > > Because I
> > > > > > > >>>>>> have a lot of 3ds file. Each one has object3ds with
> > > different color. I
> > > > > > > >>>>>> don't want to hard code to assign this. It's not accord
> with
> > > my
> > > > > > > >>>>>> business.
> > > > > > > >>>>>> If I use loading another file(.dae, .obj...) in away3d
> that
> > > cans show
> > > > > > > >>>>>> original color of object?
> >
> > > > > > > >>>>>> Do you have any way to do this?
> >
> > > > > > > >>>>>> Regards,
> > > > > > > >>>>>> danhpc
> >
> > > > > > > >>>>>> On May 17, 5:22 pm, Michael Iv <[email protected]>
> > > wrote:
> > > > > > > >>>>>>> You can't.Away3D assigns usually by default a random
> > > ColorMaterial to
> > > > > > > >>>>>> the
> > > > > > > >>>>>>> objects that have no texture supplied.But you can
> always
> > > assign your own
> > > > > > > >>>>>>> color inside Away3D :)
> >
> > > > > > > >>>>>>> On Tue, May 17, 2011 at 1:16 PM, danhpc <
> > > [email protected]
> > > > > > > >>>>>>> wrote:
> >
> > > > > > > >>>>>>>> Hi all,
> >
> > > > > > > >>>>>>>> I'm newbie in away3d. I have a problem that is loading
> > > original color
> > > > > > > >>>>>>>> of object3d which was made from 3DS MAX.
> > > > > > > >>>>>>>> I have a model 3d without material (because some model
> > > don't have
> > > > > > > >>>>>>>> material, it just have color). I have just assined
> color
> > > to it then
> > > > > > > >>>>>>>> export it to 3ds file. I want to load that model with
> > > assigned
> > > > > > > >>>>>>>> color.
> > > > > > > >>>>>>>> Because I have yet to set the material property on any
> of
> > > our meshes.
> > > > > > > >>>>>>>> They are all displayed using the default material type
> - a
> > > > > > > >>>>>>>> WireColorMaterial object with a random color defined
> for
> > > the surface
> > > > > > > >>>>>>>> fill. --> That I don't want.
> >
> > > > > > > >>>>>>>> How can I load my model with assigned color like the
> model
> > > which I
> > > > > > > >>>>>>>> drew from beginning in .max file?
> >
> > > > > > > >>>>>>>> ex:
> > > > > > > >>>>>>>> I have Box, I set green color to box and then export
> to
> > > 3ds file. Then
> > > > > > > >>>>>>>> show that model with that color without mesh type.
> >
> > > > > > > >>>>>>>> Could you please help me out?
> >
> > > > > > > >>>>>>> --
> > > > > > > >>>>>>> Michael Ivanov ,Programmer
> > > > > > > >>>>>>> Neurotech Solutions Ltd.
> > > > > > > >>>>>>> Flex|Air |3D|Unity|www.neurotechresearch.comhttp://
> > > blog.alladvanced.net
> > > > > > > >>>>>>> Tel:054-4962254
> > > > > > > >>>>>>> [email protected]
> > > > > > > >>>>>>> [email protected]
> >
> > > > > > > >>>>> --
> > > > > > > >>>>> Michael Ivanov ,Programmer
> > > > > > > >>>>> Neurotech Solutions Ltd.
> >
> > ...
> >
> > read more ยป