Hi Richard, I tried with ActionScript project. It worked. But That was not what I want. In previous version of away3d I can do it. The same that way, it worked well. (I create a class extends UIComponent and call this class from mxml. It worked.)
Why in this version(4.0) doesn't support? I mean we can call that class from mxml file. stage should not be null. it seems that stage was not init. Regards, D On Thu, May 19, 2011 at 4:49 AM, richardolsson <[email protected]> wrote: > The way you are supposed to use the examples is to create a single > ActionScript application project that includes all of them, and then > right click the example you want to use, and select "Set as default > application". That makes it a executable (and the default) > application. If you then right-click again and run (or select "run" > through any of the other means of doing so in Flash Builder), it will > build and run that example. > > Trying to instantiate the example class from another app will likely > throw errors because what happens in the constructor assumes that it's > in the document class constructor, meaning that root and stage is > always available there. > > > Cheers > /R > > > On May 19, 12:51 pm, Cong Danh Pham <[email protected]> > wrote: > > 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\HoverDr > agController.as:41] > > at > > > LoaderOBJTest()[D:\Working\Study\workspace\TestBroomStick\src\LoaderOBJTest > .as:74] > > at > > > Main/application1_creationCompleteHandler()[D:\Working\Study\workspace\Test > BroomStick\src\Main.mxml:27] > > at > > > Main/___Main_Application1_creationComplete()[D:\Working\Study\workspace\Tes > tBroomStick\src\Main.mxml:4] > > at flash.events::EventDispatcher/dispatchEventFunction() > > at flash.events::EventDispatcher/dispatchEvent() > > at > > > mx.core::UIComponent/dispatchEvent()[E:\dev\hero_private\frameworks\project > s\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\fram > eworks\projects\framework\src\mx\managers\LayoutManager.as:842] > > at > > > mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\hero_priv > ate\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: > > > > ... > > > > read more ยป
