Glue channels - how to preload sounds and images?

46 views
Skip to first unread message

davem2007

unread,
Oct 4, 2012, 10:40:58 AM10/4/12
to junaio-d...@googlegroups.com
I'm having trouble getting images and sounds to load quickly. Have made file sizes small but
some preloading would help.Should I do this in javascript?
thanks dave

Stefan

unread,
Oct 4, 2012, 11:23:27 AM10/4/12
to junaio-d...@googlegroups.com

davem2007

unread,
Oct 8, 2012, 4:55:53 AM10/8/12
to junaio-d...@googlegroups.com
thanks stefan
dave

davem2007

unread,
Oct 8, 2012, 9:07:25 AM10/8/12
to junaio-d...@googlegroups.com
Hi Stefan
This looks promising ... but not sure where to add it
 <parameters>
       
<parameter key="cachedFile1">http://yourserver.com/yourmodel.zip</parameter>
       
<parameter key="cachedFile2">http://yourserver.com/sound.mp3</parameter>
   
</parameters>
Can you please give me an example of how I would use this? Would I add this code into my arelGLUE5.js or search.php?
thanks again, dave

christin

unread,
Oct 8, 2012, 9:16:55 AM10/8/12
to junaio-d...@googlegroups.com
Hi Dave,

I put these lines in the search.php: This adds a parameter to my object with the ID "weapon"
$oObject->addParameter("sound", "http://www.....mp3");
ArelXMLHelper::outputObject($oObject);
And this one in the arel.js to pick the sound in the parameter:
arel.Media.startSound(arel.Scene.getObject("weapon").getParameter("sound"));


Hope this will help you.
christin
--
 
 
 

davem2007

unread,
Oct 8, 2012, 10:32:50 AM10/8/12
to junaio-d...@googlegroups.com, terwe...@googlemail.com
Hi cristin
Thanks for coming to my rescue once again! Cant get it working yet, am not sure if I'm using the ID properly, any ideas...??

In my search.php:
$oObject = ArelXMLHelper::createGLUEModel3DFromImage(
"image-robin_cell_floor",
WWW_ROOT . "/resources/robin_cell_floor.png", 
array(10, -280, 20), //translation 
array(2,4,4), //scale
new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(-90,-30,0)), //rotation
4 //CoordinateSystemID)
);
// preloading sounds
$oObject->addParameter("sound_jail_door", "http://davemiller.org/ar/sounds/jail_door.mp3");
//output the object
ArelXMLHelper::outputObject($oObject);

-----
In my arelGLUE5.js:
arel.Media.startSound(arel.Scene.getObject("4").getParameter("sound_jail_door"));
Reply all
Reply to author
Forward
0 new messages