Re: [ASNativos] Papervision: FileLoadEvent.as
Por cierto lo he modificado la clase para que me haga lo que necesito os dejo aqui el archivo por si veis algo mal pero ami para MaterialFile me funciona por unidad. /* * PAPERON ERVIS NPAPER ISION PE IS ON PERVI IO APER SI PA * AP VI ONPA RV IO PA SI PA ER SI NP PE ON AP VI ION AP * PERVI ON PE VISIO APER IONPA RV IO PA RVIS NP PE IS ONPAPE * ER NPAPER IS PE ON PE ISIO AP IO PA ER SI NP PER * RV PA RV SI ERVISI NP ER IO PE VISIO AP VISI PA RV3D * __ * papervision3d.org � blog.papervision3d.org � osflash.org/papervision3d */ /* * Copyright 2006-2007 (c) Carlos Ulloa Matesanz, noventaynueve.com. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ // __ BITMAP FILE MATERIAL package org.papervision3d.materials { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.Loader; import flash.events.*; import flash.net.URLRequest; import flash.utils.Dictionary; import org.papervision3d.Papervision3D; import org.papervision3d.core.geom.Face3D; import org.papervision3d.core.geom.Vertex2D; import org.papervision3d.core.proto.MaterialObject3D; import org.papervision3d.events.FileLoadEvent; import org.papervision3d.objects.DisplayObject3D; /** * The BitmapFileMaterial class creates a texture by loading a bitmap from an external file. * * Materials collect data about how objects appear when rendered. */ public class BitmapFileMaterial extends BitmapMaterial { // ___ PUBLIC /** * Add by Alvaro Touzon is preloader. * lo que hago es un display object que usare para que actue como preloader independiente */ public var preloader:Object = null; /** * The URL that has been requested. */ public var url :String = ""; /** * Whether or not the texture has been loaded. */ public var loaded :Boolean; /** * Function to call when the last image has loaded. */ static public var callback :Function; /** * The color to use in materials before loading has finished. */ static public var LOADING_COLOR :int = MaterialObject3D.DEFAULT_COLOR; /** * The color to use for the lines when there is an error. */ static public var ERROR_COLOR:int = MaterialObject3D.DEBUG_COLOR; /** * A texture object. */ override public function get texture():Object { return this._texture; } /** * @private */ override public function set texture( asset:Object ):void { if( asset is String == false ) { Papervision3D.log("Error: BitmapFileMaterial.texture requires a String for the texture"); return; } bitmap = createBitmapFromURL( String(asset) ); _texture = asset; } /** * Internal * * Used to define if the loading had failed. */ private var errorLoading:Boolean = false; // ___ NEW /** * The BitmapFileMaterial class creates a texture by loading a bitmap from an external file. * * @paramurlThe URL of the requested bitmap file. * @paraminitObject[optional] - An object that contains additional properties with which to populate the newly created material. */
Re: [ASNativos] Papervision: FileLoadEvent.as
si lo veo pero para que usazs DisplayObject3D? Lo que no veo es que traces e,target.name, lo voy a probar. Si es conjuno el XML en as3 El día 7 de mayo de 2008 11:48, drusunlimited listas < [EMAIL PROTECTED]> escribió: > Hola Alvaro, he probado a ponerle name al material para poder > recuperarlo desde el evento y me funciona perfectamente. > > Perdona la perogrullada pero es por centranos, y es que no se me > ocurre otra cosa: el FileLoadEvent que recibe la funcion onLoading > hace referencia al material, no al displayObject3D sobre el que se > aplica el material, entonces... > > ¿estás creando un material diferente (y dandole un nombre diferente) > para cada displayObject donde aplicas el material en ese for? > > A mi algo así me funciona: > [code] > for(var i:Number=0;ivar holder_item:DisplayObject3D=new DisplayObject3D(); > stage.addChild(holder_item); >var img:String=_xml.item.attribute("img")[i]; //esto es maravilloso > por cierto :) > var materialFront:BitmapFileMaterial=new BitmapFileMaterial(img); > materialFront.name="minombre"+i; > > materialFront.addEventListener(FileLoadEvent.LOAD_COMPLETE,onLoaded); > > materialFront.addEventListener(FileLoadEvent.LOAD_PROGRESS,onLoading); > } > > private function onLoaded(e:FileLoadEvent):void{ > trace(e.bytesLoaded+" >> target << "+e.target.name); > } > > private function onLoading(e:FileLoadEvent):void{ >trace(e.bytesLoaded); > } > > [/code] > > Un saludo > > 2008/5/7 Alvaro Touzon <[EMAIL PROTECTED]>: > > Hola Javier, si el problema esta aqui al menos sobre flash, yo uso la > > principal de as3. > > Mira > > si cambias esto > > > > private function onLoading(e:FileLoadEvent):void{ > >trace(e.bytesLoaded); > >} > > por esto > > > > private function onLoading(e:FileLoadEvent):void{ > >trace(e.bytesLoaded+" target"+e.target.name); > > > >} > > a mi solo me sale el nombre del primer item de la secuencia. Con lo > cual no > > puedo hacer un preloader por secuancia. > > Espero que me entiendas, muchas gracias > > > > > > > > El día 6 de mayo de 2008 22:44, Javier Fernández Montes < > > [EMAIL PROTECTED]> escribió: > > > > > > > > > Hola Alvaro, desde mi desconocimiento, puesto que estoy empezando con > > > papervision, te puedo decir que a mi me funcionan los eventos sin > > > problemas. > > > > > > ¿qué rama de papervision utilizas? > > > Yo uso la greatwhite desde flex y va como la seda, salvo unos cuanto > > > warnings por omisión de tipos/retornos que he tenido que corregir a > > > mano, pero que no impedían compilar. > > > > > > Ahora mismo estoy haciendo una frikada tipo: > > > [code] > > >... > > >public function fInitArchive():void{ > > >var l:Number=_xml.children().length(); > > >holder_archivo=new DisplayObject3D(); > > >basicview.scene.addChild(holder_archivo); > > >rueda_archivo=new DisplayObject3D(); > > >holder_archivo.addChild(rueda_archivo); > > >holder_archivo.z=500; > > >for(var i:Number=0;i > >var holder_item:DisplayObject3D=new > > > DisplayObject3D(); > > >rueda_archivo.addChild(holder_item); > > >var > img:String=_xml.item.attribute("img"); > > >var > materialFront:BitmapFileMaterial=new > > > BitmapFileMaterial(img); > > >var > materialBack:BitmapFileMaterial=new > > > BitmapFileMaterial(img); > > >materialFront.smooth=true; > > > > > > materialFront.addEventListener(FileLoadEvent.LOAD_COMPLETE,onLoaded); > > > > > > > materialFront.addEventListener(FileLoadEvent.LOAD_PROGRESS,onLoading); > > >var itemFront:Plane=new > > > Plane(materialFront,290,56,14,4); > > >var itemBack:Plane=new > > > Plane(materialBack,290,56,1,1); > > >holder_item.addChild(itemFront); > > >holder_item.addChild(itemBack); > > >itemFront.x=itemBack.x=750; > > >itemBack.rotationY=180; > > >holder_item.rotationZ=i*(180/l); > > >} > > > > > > stage.addEventListener(Event.ENTER_FRAME,renderLoop); > > >} > > >private function onLoaded(e:FileLoadEvent):void{ > > >trace(e.bytesTotal); > > >} > > >private function onLoading(e:FileLoadEvent):void{ > > >trace(e.bytesLoaded); > > >} > > >... > > > [/code] > >
Re: [ASNativos] Papervision: FileLoadEvent.as
Hola Alvaro, he probado a ponerle name al material para poder recuperarlo desde el evento y me funciona perfectamente. Perdona la perogrullada pero es por centranos, y es que no se me ocurre otra cosa: el FileLoadEvent que recibe la funcion onLoading hace referencia al material, no al displayObject3D sobre el que se aplica el material, entonces... ¿estás creando un material diferente (y dandole un nombre diferente) para cada displayObject donde aplicas el material en ese for? A mi algo así me funciona: [code] for(var i:Number=0;i> target << "+e.target.name); } private function onLoading(e:FileLoadEvent):void{ trace(e.bytesLoaded); } [/code] Un saludo 2008/5/7 Alvaro Touzon <[EMAIL PROTECTED]>: > Hola Javier, si el problema esta aqui al menos sobre flash, yo uso la > principal de as3. > Mira > si cambias esto > > private function onLoading(e:FileLoadEvent):void{ >trace(e.bytesLoaded); >} > por esto > > private function onLoading(e:FileLoadEvent):void{ >trace(e.bytesLoaded+" target"+e.target.name); > >} > a mi solo me sale el nombre del primer item de la secuencia. Con lo cual no > puedo hacer un preloader por secuancia. > Espero que me entiendas, muchas gracias > > > > El día 6 de mayo de 2008 22:44, Javier Fernández Montes < > [EMAIL PROTECTED]> escribió: > > > > > Hola Alvaro, desde mi desconocimiento, puesto que estoy empezando con > > papervision, te puedo decir que a mi me funcionan los eventos sin > > problemas. > > > > ¿qué rama de papervision utilizas? > > Yo uso la greatwhite desde flex y va como la seda, salvo unos cuanto > > warnings por omisión de tipos/retornos que he tenido que corregir a > > mano, pero que no impedían compilar. > > > > Ahora mismo estoy haciendo una frikada tipo: > > [code] > >... > >public function fInitArchive():void{ > >var l:Number=_xml.children().length(); > >holder_archivo=new DisplayObject3D(); > >basicview.scene.addChild(holder_archivo); > >rueda_archivo=new DisplayObject3D(); > >holder_archivo.addChild(rueda_archivo); > >holder_archivo.z=500; > >for(var i:Number=0;i >var holder_item:DisplayObject3D=new > > DisplayObject3D(); > >rueda_archivo.addChild(holder_item); > >var img:String=_xml.item.attribute("img"); > >var materialFront:BitmapFileMaterial=new > > BitmapFileMaterial(img); > >var materialBack:BitmapFileMaterial=new > > BitmapFileMaterial(img); > >materialFront.smooth=true; > > > > materialFront.addEventListener(FileLoadEvent.LOAD_COMPLETE,onLoaded); > > > > materialFront.addEventListener(FileLoadEvent.LOAD_PROGRESS,onLoading); > >var itemFront:Plane=new > > Plane(materialFront,290,56,14,4); > >var itemBack:Plane=new > > Plane(materialBack,290,56,1,1); > >holder_item.addChild(itemFront); > >holder_item.addChild(itemBack); > >itemFront.x=itemBack.x=750; > >itemBack.rotationY=180; > >holder_item.rotationZ=i*(180/l); > >} > > > > stage.addEventListener(Event.ENTER_FRAME,renderLoop); > >} > >private function onLoaded(e:FileLoadEvent):void{ > >trace(e.bytesTotal); > >} > >private function onLoading(e:FileLoadEvent):void{ > >trace(e.bytesLoaded); > >} > >... > > [/code] > > > > Y ya te digo que ningún problema. > > > > > > Javier Fernández :: Drus Unlimited™ > > listas[at]drusunlimited[dot]com > > http://drusunlimited.com > > > > El 05/05/2008, a las 12:39, Alvaro Touzon escribió: > > > > > Hola estoy empezando con papervision y cuando creo una galeria de x > > > img , > > > con "BitmapFileMaterial", y realizo un preloader LOAD_PROGRESS, no me > > > actualiza los datos del target, me mantiene el del primer material > > > que > > > llamo. > > > > > > var material:BitmapFileMaterial = new BitmapFileMaterial(img); > > > > > > > > >material.addEventListener(FileLoadEvent.LOAD_COMPLETE, > > > onLoaded); > > >material.addEventListener(FileLoadEvent.LOAD_PROGRESS, > > > onLoading); > > > > > > Algu no ha tenido ya este problema he visto por google peo no le veo > > > la > > > solucion, intentare darsela pero lo veo lejos, pues no conocco bien > > > el > > > framework. > >
Re: [ASNativos] Papervision: FileLoadEvent.as
Hola Javier, si el problema esta aqui al menos sobre flash, yo uso la principal de as3. Mira si cambias esto private function onLoading(e:FileLoadEvent):void{ trace(e.bytesLoaded); } por esto private function onLoading(e:FileLoadEvent):void{ trace(e.bytesLoaded+" target"+e.target.name); } a mi solo me sale el nombre del primer item de la secuencia. Con lo cual no puedo hacer un preloader por secuancia. Espero que me entiendas, muchas gracias El día 6 de mayo de 2008 22:44, Javier Fernández Montes < [EMAIL PROTECTED]> escribió: > Hola Alvaro, desde mi desconocimiento, puesto que estoy empezando con > papervision, te puedo decir que a mi me funcionan los eventos sin > problemas. > > ¿qué rama de papervision utilizas? > Yo uso la greatwhite desde flex y va como la seda, salvo unos cuanto > warnings por omisión de tipos/retornos que he tenido que corregir a > mano, pero que no impedían compilar. > > Ahora mismo estoy haciendo una frikada tipo: > [code] >... >public function fInitArchive():void{ >var l:Number=_xml.children().length(); >holder_archivo=new DisplayObject3D(); >basicview.scene.addChild(holder_archivo); >rueda_archivo=new DisplayObject3D(); >holder_archivo.addChild(rueda_archivo); >holder_archivo.z=500; >for(var i:Number=0;ivar holder_item:DisplayObject3D=new > DisplayObject3D(); >rueda_archivo.addChild(holder_item); >var img:String=_xml.item.attribute("img"); >var materialFront:BitmapFileMaterial=new > BitmapFileMaterial(img); >var materialBack:BitmapFileMaterial=new > BitmapFileMaterial(img); >materialFront.smooth=true; > > materialFront.addEventListener(FileLoadEvent.LOAD_COMPLETE,onLoaded); > > materialFront.addEventListener(FileLoadEvent.LOAD_PROGRESS,onLoading); >var itemFront:Plane=new > Plane(materialFront,290,56,14,4); >var itemBack:Plane=new > Plane(materialBack,290,56,1,1); >holder_item.addChild(itemFront); >holder_item.addChild(itemBack); >itemFront.x=itemBack.x=750; >itemBack.rotationY=180; >holder_item.rotationZ=i*(180/l); >} > > stage.addEventListener(Event.ENTER_FRAME,renderLoop); >} >private function onLoaded(e:FileLoadEvent):void{ >trace(e.bytesTotal); >} >private function onLoading(e:FileLoadEvent):void{ >trace(e.bytesLoaded); >} >... > [/code] > > Y ya te digo que ningún problema. > > > Javier Fernández :: Drus Unlimited™ > listas[at]drusunlimited[dot]com > http://drusunlimited.com > > El 05/05/2008, a las 12:39, Alvaro Touzon escribió: > > > Hola estoy empezando con papervision y cuando creo una galeria de x > > img , > > con "BitmapFileMaterial", y realizo un preloader LOAD_PROGRESS, no me > > actualiza los datos del target, me mantiene el del primer material > > que > > llamo. > > > > var material:BitmapFileMaterial = new BitmapFileMaterial(img); > > > > > >material.addEventListener(FileLoadEvent.LOAD_COMPLETE, > > onLoaded); > >material.addEventListener(FileLoadEvent.LOAD_PROGRESS, > > onLoading); > > > > Algu no ha tenido ya este problema he visto por google peo no le veo > > la > > solucion, intentare darsela pero lo veo lejos, pues no conocco bien > > el > > framework. > > Gracias. > > - > > ASNativos > > www.5dms.com > > subscripciones/desubscripciones > > http://asnativos.5dms.com > > - > > > - > ASNativos > www.5dms.com > subscripciones/desubscripciones > http://asnativos.5dms.com > - > - ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -
Re: [ASNativos] Papervision: FileLoadEvent.as
Hola Alvaro, desde mi desconocimiento, puesto que estoy empezando con papervision, te puedo decir que a mi me funcionan los eventos sin problemas. ¿qué rama de papervision utilizas? Yo uso la greatwhite desde flex y va como la seda, salvo unos cuanto warnings por omisión de tipos/retornos que he tenido que corregir a mano, pero que no impedían compilar. Ahora mismo estoy haciendo una frikada tipo: [code] ... public function fInitArchive():void{ var l:Number=_xml.children().length(); holder_archivo=new DisplayObject3D(); basicview.scene.addChild(holder_archivo); rueda_archivo=new DisplayObject3D(); holder_archivo.addChild(rueda_archivo); holder_archivo.z=500; for(var i:Number=0;ihttp://drusunlimited.com El 05/05/2008, a las 12:39, Alvaro Touzon escribió: > Hola estoy empezando con papervision y cuando creo una galeria de x > img , > con "BitmapFileMaterial", y realizo un preloader LOAD_PROGRESS, no me > actualiza los datos del target, me mantiene el del primer material > que > llamo. > > var material:BitmapFileMaterial = new BitmapFileMaterial(img); > > >material.addEventListener(FileLoadEvent.LOAD_COMPLETE, > onLoaded); >material.addEventListener(FileLoadEvent.LOAD_PROGRESS, > onLoading); > > Algu no ha tenido ya este problema he visto por google peo no le veo > la > solucion, intentare darsela pero lo veo lejos, pues no conocco bien > el > framework. > Gracias. > - > ASNativos > www.5dms.com > subscripciones/desubscripciones > http://asnativos.5dms.com > - - ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -
[ASNativos] Papervision: FileLoadEvent.as
Hola estoy empezando con papervision y cuando creo una galeria de x img , con "BitmapFileMaterial", y realizo un preloader LOAD_PROGRESS, no me actualiza los datos del target, me mantiene el del primer material que llamo. var material:BitmapFileMaterial = new BitmapFileMaterial(img); material.addEventListener(FileLoadEvent.LOAD_COMPLETE, onLoaded); material.addEventListener(FileLoadEvent.LOAD_PROGRESS, onLoading); Algu no ha tenido ya este problema he visto por google peo no le veo la solucion, intentare darsela pero lo veo lejos, pues no conocco bien el framework. Gracias. - ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -
Re: [ASNativos] papervision
Si te manejas en ingles aqui tienes: http://flashenabled.wordpress.com/2007/03/08/how-to-start-working-3d-with-papervision-3d/ un saludete! fernando b wrote: > salu2 > > alguien conoce algun link para iniciarse en este tema > los ejemplos, documentacion, etc..se me quedan un POCO grandesme > gustaria algo tipo 'papervision para torpes', si es de forges mejor q mejor > :-) > > chau > > - ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -
[ASNativos] papervision
salu2 alguien conoce algun link para iniciarse en este tema los ejemplos, documentacion, etc..se me quedan un POCO grandesme gustaria algo tipo 'papervision para torpes', si es de forges mejor q mejor :-) chau -- http://www.jinx.com.es - ASNativos www.5dms.com subscripciones/desubscripciones http://asnativos.5dms.com -