Yeah , I added check for Mesh type. Iterator would be nice to have :) . So far hacked it for my needs.
Thanks a lot . On Wed, May 18, 2011 at 4:31 PM, richardolsson <[email protected]> wrote: > @Michael: > No, the assets vector will not be exposed outside the library, because > then the library cannot prevent you from modifying it without the > library knowing (which breaks the entire mapping between name and > asset.) > > However, there will likely at some point be an iterator interface to > let you loop over assets without letting you modify the internal list. > Whether is a separate class, or a part of the AssetLibrary interface > remains to be decided. But I can imagine it being a separate class, > since it's probably not something you want to do very often anyway: > > var it : LibraryIterator = AssetLibrary.getIterator(); > var asset : IAsset; > while (asset = it.next()) { > trace(asset.name); > } > > What you are doing in your example (where m is a Mesh) would crash at > the first asset that is not a mesh. > > > Cheers > /R > > On May 18, 1:17 pm, Michael Iv <[email protected]> wrote: > > BTW some thought on AssetLibrary class.Can you guys expose _assets > variable > > into outside world? > > > > So that we can do something like this: > > > > for each(var m:Mesh in _myAssetLib){ > > > > trace(m.name); > > > > } > > > > ? > > > > Thanks. > > > > > > > > > > > > > > > > > > > > On Wed, May 18, 2011 at 2:15 PM, richardolsson <[email protected]> > wrote: > > > Yeah, so to elaborate on what Fabrice quotes above from GitHub; There > > > will soon be a MESH_COMPLETE event that you can listen for, to avoid > > > having to check assetType, if you'd prefer to do that. I will probably > > > push it later today or tomorrow as part of another update to the > > > AssetLibrary. > > > > > Cheers > > > /R > > > > > On May 18, 1:04 pm, Fabrice3D <[email protected]> wrote: > > > > last comments on github: > > > > Investigate implementing separate COMPLETE events for every asset > type, > > > e.g. MATERIAL_COMPLETE, BITMAP_COMPLETE, MESH_COMPLETE et c. This would > > > please good old Fabrice, as it would indeed make loading of simple > meshes > > > easier, and shouldn't be too hard to implement. > > > > > > Good old Fabrice :D > > > > > > On May 18, 2011, at 12:52 PM, Michael Iv wrote: > > > > > > > Richard you are right. But when checking for assetType == > > > AssetType.MATERIAL the debuger doesn't enter the statement at all. For > more > > > info ,what I do is loading 3Ds model assuming that its texture is > loaded > > > automatically. That is why I switched to BITMAP .Also would like to ask > you > > > as a complete N00b what are the cases I would receive > AssetType.MATERIAL > > > type ? > > > > > > > On Wed, May 18, 2011 at 1:47 PM, richardolsson < > [email protected]> > > > wrote: > > > > > @Michael: > > > > > That code looks dangerous. Right now you are assuming that the > assets > > > > > that are returned are either bitmaps or meshes. If a material is > > > > > returned, that code will crash. > > > > > > > Either check for assetType == AssetType.MATERIAL (and set the > assets > > > > > mipmap property) or do what you do now but make sure to check that > the > > > > > asset is really a mesh (assetType == AssetType.MESH). > > > > > > > Cheers > > > > > /R > > > > > > > On May 18, 12:42 pm, Michael Iv <[email protected]> wrote: > > > > > > This worked: > > > > > > > > private function onAssetComplete(e:AssetEvent):void{ > > > > > > if(e.asset.assetType == AssetType.BITMAP){ > > > > > > BitmapDataAsset(e.asset).name; > > > > > > }else{ > > > > > > Mesh(e.asset).material.mipmap=false; > > > > > > > > } > > > > > > } > > > > > > > > :) . > > > > > > Feeling a total n00b with Away4 ;) ! > > > > > > > > On Wed, May 18, 2011 at 1:33 PM, Michael Iv < > [email protected]> > > > wrote: > > > > > > > @John it is 2048x512 > > > > > > > > > @Richard so where do i ACCESS the mipmap property? on the > material? > > > > > > > > > Tnx > > > > > > > > > On Wed, May 18, 2011 at 1:29 PM, John Brookes < > > > [email protected]>wrote: > > > > > > > > >> or > > > > > > >> Just resize the image in photoshop to power of 2 square > > > > > > >> It will still work. > > > > > > > > > -- > > > > > > > Michael Ivanov ,Programmer > > > > > > > Neurotech Solutions Ltd. > > > > > > > Flex|Air |3D|Unity| > > > > > > >www.neurotechresearch.com > > > > > > >http://blog.alladvanced.net > > > > > > > Tel:054-4962254 > > > > > > > [email protected] > > > > > > > [email protected] > > > > > > > > -- > > > > > > 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. > > > > > Flex|Air |3D|Unity| > > > > >www.neurotechresearch.com > > > > >http://blog.alladvanced.net > > > > > Tel:054-4962254 > > > > > [email protected] > > > > > [email protected] > > > > -- > > 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. Flex|Air |3D|Unity| www.neurotechresearch.com http://blog.alladvanced.net Tel:054-4962254 [email protected] [email protected]
