Digital Workshop

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: script failure in flex publish
PostPosted: December 29th, 2004, 12:22 pm 
Offline

Joined: December 29th, 2004, 12:00 pm
Posts: 230
Location: Auckland NZ
Opus: v 7.04
OS: xp & win7
I want to display a rotating object in flex. I have done so by photographing a model in 20 positions on a turntable.
I put all the images in a slideshow.
I make 20 mouseover buttons side by side to 'go to slide' numbers 1 - 20.
This works fine - you can see it if you wish on www.macsnapper.com select flash tests.
but
to avoid the tedium of making 20 buttons the correct size and position each time I make a new presentation (since the objects will have different sizes or proportions) I thought I could make it more automatic by using script to make active 'zones' distributed across the width of the slideshow object, using the mouse x position to select the appropriate slide to show...
The following script works when I am developing/testing but fails when I publish - can anyone please tell me why???

------- the script-------

var slideshowWidth = Slideshow.GetWidth()
var mousePos = GetMousePosition()
var mouseX = mousePos.x
var zoneSize = slideshowWidth/20 \\(if there are 20 slide images)
var slideNum = mouseX/zoneSize \\ relates the x-pos to the slide no.
var slideNum = Math.round(slideNum)
Slideshow.GotoSlide(slideNum)

-------- end script --------------


Top
 Profile  
 
 Post subject: flex
PostPosted: December 29th, 2004, 10:43 pm 
Offline

Joined: November 11th, 2004, 4:05 am
Posts: 636
Location: Christchurch, NZ
Hi mac,
I hope the weather is better in Auckland than it is in Levin.
Your script looks ok to me -- maybe the trigger used is not recognised when you publish to Flex.

The script below published OK to Flex with 2 images in the Slideshow.
I used the RegisterEventHandler 'mousemove' function as a trigger because it works ok in Flex as a substitute for a 'while' loop.

//---------- start script --------------------------

imageNum=2;
slideshowWidth = Slideshow.GetWidth()
zoneSize = slideshowWidth/imageNum

RegisterEventHandler("mousemove", OnMouseMove);
function OnMouseMove(pos) {
mousePos = GetMousePosition()
mouseX = pos.x
slideNum = Math.round(mouseX/zoneSize)
Slideshow.GotoSlide(slideNum)
} // end function

//----------- end script -------------------------

pub enclosed (Pro 4.21) and published flex files.

Paul


Top
 Profile  
 
 Post subject:
PostPosted: December 30th, 2004, 12:47 am 
Offline

Joined: December 29th, 2004, 12:00 pm
Posts: 230
Location: Auckland NZ
Opus: v 7.04
OS: xp & win7
Thank you so much Paul - that does it...
I was using a script triggered by a mouse move action, but your eventhandler option has solved it.
and no, the weather in Auckland is LOUSY !


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

All times are UTC [ DST ]


Who is online

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