Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  JavaScript    Post Event help...

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hey, i will use javascript to post an event from my HTML page

when i use this interactor

<MTSInteractor Name="sound_ready">
<MTSHandle Event="test" Action="MTSJavaScript" Func="alert('test');"/>
</MTSInteractor>

I will get an alert window that says "Test"

However what i wish to do is send something to a flash control i have
so i have
<MTSAction Name="playSound" >
<MTSAssignProperty Target="MTSTimeElem.bar_loader.SWF._root.here.playBar(2000)" />
</MTSAction>

<MTSTimeElem Type="SWFView" Name="button" On="1" PostAnimator="1" Path="button.swf" Loop="0" />


<MTSInteractor Name="play_sound">
<MTSHandle Event="test" Action="playSound"/>
</MTSInteractor>

These functions do work, except when i try to trigger them using javascript in HTML with PostEvent anything i'm doing wrong here?
 
Posts: 38 | Registered: July 04, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Just as an aside i am actually using this code in the html

var name = 'test';
var delay = '5';
var cmdstr = "PostEvent (" + name + "," + delay + ")";

function sound() {
vmp.Execute(cmdstr);
}

It might be that this function comes way too quickly before anything else gets a chance to load, but how would i delay it further? every time i change the delay number i get the same problem.
 
Posts: 38 | Registered: July 04, 2006Reply With QuoteEdit or Delete MessageReport This Post
Member
Picture of Admin
Posted Hide Post
Hello,

Is there any reason why you have to do the post event using vmp.Execute? If not, I would suggest doing it with vmp.PostEvent like so:

var name = 'test';
var delay = '5';
var cmdstr = "PostEvent (" + name + "," + delay + ")";

function sound() {
vmp.PostEvent(" + name + "," + delay + ");
}

Let me know if that works. For complete reference on javascript commands made available to interface with the VMP through MTS3Interface.js, refer to the Viewpoint Rich Media Authoring Guide, pages 161 - 163
 
Posts: 1188 | Registered: January 08, 2003Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  JavaScript    Post Event help...