Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint Tips, Tricks & Hacks    Passing (loading) data from Flash to MTX

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hello once again! We have a new project we are working on here and am trying to figure out the method to go about doing this

I have models that aren't using textures, but colors (basic stuff). I have the animations and interactors set up so that I can call to them from the html, and the colors change.

What we want to do, however, is be able to actualy pass a dynamic value from Flash to the MTX scene. Both are embedded seperately in the HTML file. I have been streaming through all these posts with FSCommand in it, and the closest I have come to an answer is "Yes, you need to use FSCommand to communicate to the Javscript which will communicate to the MTX", but no examples on HOW to do it, specifically pass a diffuse value. I found out how to trigger an animation from Flash, but I actually need to pass the value into the animation that is to be triggered, from javascript. MY java guy knows how to get the color from Flash to the javascript on the page.

So, basicly, I am looking for a SPECIFIC example of passing the RGB value from javascript to the MTX MTSTimeline element, and replace the empty value with the dynamic value.

Thanks in advance for any suggestions or links.

Code im using so far in MTX:

<MTSTimeElem Type="Keyframe" Name="change_OutsideColor_red" On="0" AutoStop="1">
<Target Name="tennis_brown" Property="difc" Timeline="T1" />
<Time> 0 .25 </Time>
<Timeline Name="T1" Type="3D" > * [ 1 0 0 ] </Timeline>
</MTSTimeElem>

<MTSInteractor Name="colorChange_OS_red">
<MTSHandle Event="OS_red_msg" Action="Trigger" Target="MTSTimeElem.change_OutsideColor_red" />
</MTSInteractor>

This message has been edited. Last edited by: Media Outbreak,
 
Posts: 105 | Registered: March 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
First off, Thanks Admin, you inadvertantly helped me start to figure this out in another post of yours. I found the information on Page 161-163 of the viewpoint rich media guide to be helpful in this area, though I am still missing something.

I am using this function on my HTML page:

funtion setICColor(){
vmp.SetProperty('MTSMaterial.tennis_green', 'difc', '0 0 1', '3D');
}

But something here is not correct in the script. Any suggestions?

Thanks!
 
Posts: 105 | Registered: March 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
Instead of '3D' it should be 'mts_pnt3d'
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
quote:
Originally posted by Admin:
Instead of '3D' it should be 'mts_pnt3d'


Thanks admin! It works now when I set the script on a form button, such as:

<input name="blue" type=button value="Blue Court" onclick="vmp.SetProperty('MTSMaterial.tennis_green', 'difc', '0 0 1', 'mts_pnt3d')">

But still trying to get the function version working. It almost as if its working, but not showing it, as I click it, it doesnt look like anything happaned, but then if I hit the button that has the command dirrectly on it, nothing happens, as it it is blue already but not showing it. What made lead me to believe that was also how if I hit the button that calls the function, it doesnt look like it loaded... BUT... if I hit the reset color button it goes to blue real quick before doing its fade to default color.

Im u sing this funtion:

funtion setICColor(){
vmp.SetProperty('MTSMaterial.tennis_green', 'difc', '0 0 1', 'mts_pnt3d');
}

Thanks for the heads up on the wrong property!
 
Posts: 105 | Registered: March 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
Glad to hear!

As far as your other problem, any progress there? I'm sorry, but I can't understand the problem from what you wrote. Could you describe it again?

Thanks
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
quote:
Originally posted by Admin:
Glad to hear!

As far as your other problem, any progress there? I'm sorry, but I can't understand the problem from what you wrote. Could you describe it again?

Thanks


Hi Admin!

Yes let me try to better describe the issue I am having.

I want to be able to feed a dynamic rgb value into the following Javascript function on my html page:

funtion setICColor(){
vmp.SetProperty('MTSMaterial.tennis_green', 'difc', '0 0 1', 'mts_pnt3d');
}

For testing purposes, Im just trying to get the function to work with a pre-defined value. I am calling to this function on a basic html form button, but it doesnt seem to respond. However, if I click it once (the function that turns the ground to blue), then click on the button to change the color back to default (light brown) it will flash blue for a second, and do the fade to default color, almost as if it really did turn it blue when I clicked the button that calls to the blue function, but isnt showing it, or possibly keeping that command held up in memory until the default change back to brown animation is called to.

Putting the same code right into my html form button works, but then I cant feed dynamic data into it.

The hardcoded code that works on the form button
is as follows:

<input name="blue" type=button value="Blue Court" onclick="vmp.SetProperty('MTSMaterial.tennis_green', 'difc', '0 0 1', 'mts_pnt3d')">

Thanks in advance if anyone has any ideas on this.
 
Posts: 105 | Registered: March 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
EnIgMaTiCScOrPioN
Member
Picture of e_phoenix13
Posted Hide Post
Function should be as follows:
function setICColor(r,g,b){
	var newVal = r+" "+g+" "+b;
	vmp.SetProperty("MTSMaterial.Cube_mat", "difc", newVal, "mts_pnt3d");
	vmp.SetProperty("MTSScene", "nerd", "1", "mts_int");
}


Code for the button:
<input name="blue" type=button value="Blue Court" onclick="setICColor('0','0','1');" />



Hope this helps.


Cheers,

Anup
 
Posts: 557 | Location: India | Registered: February 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
Notice Anup's use of "nerd". This is necessary to force a refresh of the scene (stands for "needs render") to see a property update that you have set. It might be the reason why you weren't seeing your button immediately turn blue.

Regards
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
EnIgMaTiCScOrPioN
Member
Picture of e_phoenix13
Posted Hide Post
Sorry abt that. I should have explained the use of Nerd.
 
Posts: 557 | Location: India | Registered: February 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
quote:
Originally posted by Admin:
Notice Anup's use of "nerd". This is necessary to force a refresh of the scene (stands for "needs render") to see a property update that you have set. It might be the reason why you weren't seeing your button immediately turn blue.

Regards


Awesome, thx for that clarification, I was wondering about that.

Thanks, anup, for the code. I was stuck on other projects today, but hoping to get back to that specific project Tues. or Wed.

Thanks again, as always, for your continued support!
 
Posts: 105 | Registered: March 16, 2007Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  Viewpoint Tips, Tricks & Hacks    Passing (loading) data from Flash to MTX