Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 5:36 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi,

Returning to this project (redoing a Pro pub animation in Flex), I thought that I had figured out how to replace 2 script items that Flex cannot use with 'Flex-friendly' ones.

I exchanged simultaneous programming for "fork" and broke up another function into components using delay's instead of "wait()"

Problem is that when I try it, the animation, which is supposed to stop scaling larger, after a specific amount of time, just keeps getting larger without stopping. :(

I'm posting the IMP in the hope that someone can suggest what I'm doing wrong and how to fix it. (I've left the original script object for reference, commenting out parts of the script that have been replaced with standard actions.)

Kind Regards,


You do not have the required permissions to view the files attached to this post.

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 6:32 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
No time currently to delve into it, but I've read on other flash/flex related forums that scripts that use var to set a local scope... sometimes needs to really be a Global variable in scope for Flex.

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


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 6:52 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Larry,

I think that what I am using are pub (global?) variables, not page (local?) variables.

Look forward to your further suggestions when you get some time to take a further look.

Thanks much.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 9:25 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
Stephen,

Regarding my post above, I may be ALL Wrong in what I said. I do not remember the exact context of what I was reading -- I thought it had to do with Actionscript or Javascript and generating a Flex or swf animation.

I looked through my FF Bookmarks, but cannot find any reference to Flex and global variable. Whatever I read stood out at the time, but now I 'lack the evidence'. So I will come back at it later.

In general, declaring a variable and using 'var' in front of the variable name -- forces it to be local. ('local' to whatever object or method has control -- eg, Page scope, a script function, etc.). Maybe there's a more correct way to say that. Most of the time in Opus development, I think 'global variable' is mainly aimed at declaring the variable for the scope of that particular Opus Page. The Flex/Flash issue aside for the moment, most of the 'discipline' around making a variable 'local' (var abc = 1 ) vs. global --- seems to want to be safe and efficient by keeping variables local, unless there is deliberate purpose for making it global.


Quote:
the animation, which is supposed to stop scaling larger, after a specific amount of time, just keeps getting larger without stopping
Isn't there a time-warp when going over to Flex? :o Maybe it depends on how you specify and meter out the time. You might try using the system clock or a Get Time kind of function to gate your animation. (which I am assuming already that you have not set any of these to be exclusive or to have the animation's wait parameter be true.)

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


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 10:57 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Larry,

Thank you for these suggestions. I think that the formula for getting the breathing animation (inhale/exhale) to work properly is somewhat complex.

If you have a chance, take a look at the script (I've kept the script object, commenting out replaced items, but you can see where the "wait" actions are needed and now translated to delays.

I am not sure what is causing the animation to expand without stopping? At least this time around, I am not getting fatal runtime errors.

I am hopeful that with a little "tweaking" that the script will work for Opus Flex, and I'll be able to create a Flash version of the animation for users who don't use Windows.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 7th, 2011, 11:59 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The keyword 'var' has no use whatsoever outside of a function.

Any variable declared in the script (but outside a function) is available anywhere within the script and page even if you declare it with var!

It's generally good practice to only use local (var) variables within a function and pass everything using parameters.

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: Another Try: Pro Pub animation redone in Flex
PostPosted: March 8th, 2011, 12:24 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Could you "translate" that so I can better understand and try to apply it in this Flex script? :?

(Meanwhile, I'll go through the script and see what I can remove.)

Thanks much.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 8th, 2011, 10:06 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Sorry Stephen, I was just elaborating for Lar.

And to clarify slightly further, although a variable defined in a script can be accessed on a page - IE you can use it in a constant expression - it does not behave the same as if you defined it in the page variables.

Code:
daftFunction()

function daftFunction()
{
for (i=3;i<10;i++)
   {
   wait(1)
   }
}


a. You could display 'i' on screen in a constant expression but the value would display '3' but not update even though the loop was iterating.

b. You could call 'i' from a button on screen and it would display 'i' at its current value in the loop.

c. you could define the 'i' using 'var' and it would be scoped to the function and any use on page would generate an error.

d. you could add 'i' to the page variables and the value in point 'a' would update on screen as it does in the loop.

As I said above, it's good practice to scope variables to functions. For example, if you created a second daftFunction that used the 'i' variable without 'var' and the two functions were ever running simultaneously, you'd cause a problem.

BTW, I didn't look at your IMP - so whether the problem is related to variables, I don't know - the post was just to clarify Lar's post.

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: Another Try: Pro Pub animation redone in Flex
PostPosted: March 8th, 2011, 1:08 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Mack,

Thanks for the clarification. I appreciate the opportunity to learn about this, and you're a great teacher!

Back to the posted IMP. Have been stuck trying to get this to work. Can you take a look? I think it may be close to working but something I'm doing wrong is holding it back.

Would much appreciate your help getting it to run in Opus Flex so I can export a SWF version.

Kind Regards,

_________________
Stephen


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 8th, 2011, 9:58 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
Thanks Mack for clearing up the discussions.

Stephen, I have looked at the Pub. The short answer is you can easily fix the first part of the problem.
In your actions under the Submit button, comment out the two FOR LOOPs that runs the scale-up and scale-down animations on Vector8.

Once you do that, you have some additional hurdles. To be blunt, I think you have lost track of the logical flow. Somehow this has evolved to be more complex than it needs to be. (I do not have the image or sound files to know the whole design, but the mixed mode of standard actions and object scripting is a difficult approach and easily broken)

I made a number of notes as I was testing and troubleshooting. Maybe they will help, maybe not. Quoted to break them out.
Quote:
1. Timing for the actions under Submit object needs rework.
Vector8.Scale(.5,.5, bar2*.3) //takes too long
Vector8.Scale(-.5,-.5,bar2*.6) //takes too long

I tested with some fixed, constant values:
Vector8.Scale(.1,.1, .25)
Vector8.Scale(-.1,-.1,.5)
So these seem like a workable pace. However IMO, the scaling action does not belong inside this Loop. Said differently, I would want to have one continuous breath IN and one continuous breath OUT. The loop effect is chopping that up -- over the span of the 6 seconds it takes to complete my one cycle (using constants).

Update: your originals work fine if you remove the For Loop.

2. For the actions under Submit object, the ---> IF (breakLoop) then <--- element has no child action to run.

3. I do not find anything that will repeat or loop the consecutive action group (cycle of breaths)

4. pub will throw an error at this point: if (!stopLoop) calcBreathing()

5. Debug pane shows all 10 or 15 minutes after Pub runs in Preview only 2 or 3 minutes.

6. I got confused around the logic.
For example, for (loop = 0;loop<bar1;loop++)
In words, this would seem to say "start a loop of breathe-in and breathe-out sequences, and then stop when you reach the specified 'number of breaths per minute'. Okay. I see where you want to call the function: minuteTimer()
But AFAICT that does not yet dovetail with the animations. And as noted in 1 above, all that loop is doing is chopping up one breath cycle.
I would think something like a Ticker countdown based on bar2 number of seconds should control one breathing cycle -- and you have that with the Scale action (potentially... if you use parameter wait as true ???)

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


Top
 Profile  
 
 Post subject: Re: Another Try: Pro Pub animation redone in Flex
PostPosted: March 8th, 2011, 10:33 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Hi Larry,

Thanks very much for your detailed reply, explanation and suggestions. I agree, my sense is that it should be relatively simple, yet has become overly complex.

I took a step back and thought about how else to achieve the animation in a Flex-friendly way. Timelines.

For each breath per minute rate for the animation exercise, the actions and/or script (without any non-Flex friendly script items) are placed on a timeline, producing timelines for 12 BPM's to 6 BPM's. Then for a 15 minute exercise starting at X (user entered) BPM's, a consecutive action group can be set up starting at the timeline for that BPM and next for the next lower BPM's timeline, to the 6 BPM timeline which would repeat for the remaining exercise time. Something like this, a tweak here or there, should work.

Kind Regards,

_________________
Stephen


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 23 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