Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 4:47 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: eval in Html5/Flash
PostPosted: February 28th, 2014, 10:21 am 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
I'd like to recognize objects based on their names. E.g. hot spot is named A_HS2, so I'd like to show an image named A_img but how to get object of this name?
eval works perfectly in Opus but doesn't work in HTML5/Flash.

Code:
var limitYposition = 700;
function displayObj(obj)
{
   var objName = obj.GetName();
   Debug.trace("object name: " + obj.GetName()  + "\n");//Mouse over object named: A_HS2

   var objLetterArr = objName.split("_");// A, HS2
   var objLetter = objLetterArr[0];// A
   var posY = eval(objLetter + ".GetPosition().y");// 750
   //window.debug.log(eval(objLetter));//nothing happens in html
   var objImg = eval(objLetter + "_img");//my object (image) named: A_img
   // how to get object Id/Name for using in HTML5/Flash?
   
   //no to so important....
   if(posY > limitYposition )
   {
      if (objImg.IsShowing() == true)
      {
         objImg.Hide();
      }
      else
      {
         objImg.Show();
      }
   }
}


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: February 28th, 2014, 11:05 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
1. eval is a method of window - so use window.eval

2. The A_img object is a child of the page and therefore you'll need to reference the page object first

NB: eval is generally not good practice

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: February 28th, 2014, 12:39 pm 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
Using a .window it means do it all in javascript. I was hoping Opus could translate it to javascript/flash for me.
With javascript is much more complicated because object names are not equal to their IDs in HTML.

Is there a DW javascript function which can get an object ID in HTML if I pass string from GetName() or GetUniqueObjectID? I did a small research in exported .js but with no success.

[update]
I tried to make it simple but it does nothing in HTML (no error code). Tested also on button - On Click and on hot spot. Opus is OK.


displayObj(D_IMG, D_drag)// passing objects to script which is on page
Code:
var limitYposition = 700;
function displayObj(imgObj, dragObj)
{
   //Debug.trace(imgObj);   
   //Debug.trace(dragObj);
   //window.console.log(imgObj);   
   //window.console.log(dragObj);
   
   var posY = dragObj.GetYPosition();// 750
   //window.console.log(posY);
   
   if(posY > limitYposition)
   {
      if (imgObj.IsShowing() == true)
      {
         imgObj.Hide();
      }
      else
      {
         imgObj.Show();
      }
   }
}


Problem is in not passing objects to the Script. If I place the script into the event it works.
Code:
var limitYposition = 700;
var posY = D_drag.GetYPosition();// 750

if(posY > limitYposition)
   {
      if (D_IMG.IsShowing() == true)
      {
         D_IMG.Hide();
      }
      else
      {
         D_IMG.Show();
      }
   }
}


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: February 28th, 2014, 2:55 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Code:
var limitYposition = 700;


Remove the 'var'

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: February 28th, 2014, 4:02 pm 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
Mack you are the real expert. It works like a charm without var (public, private, static is closer to me :-)).

Finanly I've made a small change for detecting drag object position (console.log rulezz).
Code:
dragObj.m_droppedOn == null


Opus + HTML5 works. Not Flash but not a big deal for me.

The more i work with Opus the more I have to admire DW what they have created despite the fact that everything doesn't work as I would expect. I hope they will fix HTML5 issues soon.

Help is sometimes a bit brief but I'm happy for this forum and DW email support - otherwise I'd had given it up with Opus.

Thanks.
Ota


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: March 1st, 2014, 1:21 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
ovo wrote:
Opus + HTML5 works. Not Flash but not a big deal for me.
I noticed above that you have constructed your opusscript using user-defined (ie, developer-define) functions.

If I recall from the Opus Help files (probably OpusScript Help file), that 'user-defined' functions are not supported in Flex. Please check it for yourself to verify. Also, they also mention that scripts run in Flex return results immediately (I forget how they worded that limitation).

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: eval in Html5/Flash
PostPosted: March 3rd, 2014, 8:37 am 
Offline

Joined: January 28th, 2014, 4:38 pm
Posts: 54
Location: Czech Republic
Opus: OpusPro 9.75 - HTML5 exports, Evolution
OS: Win 7 x64 CZ
System: FUJITSU
Flash doesn't see .m_droppedOn property. If I replace it for Y condition it works in Flash as well.

Thanks for your comment.
Ota


For this message ovo has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group