Page 1 of 1

Playing a sound when clicking a text on a page

Posted: Fri Jan 11, 2008 11:55 pm
by aalba
Hi, there
Can we Play a sound when clicking a text on a page of Print2Flash documents? It is very important in making a tutorial that need a sound (like giving an example of pronouncing a word or sentence in an e-book for learning forign language.

Thanks for your attention

Re: Playing a sound when clicking a text on a page

Posted: Sat Jan 12, 2008 6:04 am
by staff
Print2Flash Document APi broadcasts onSelection event whenever the user changes text selection. You may get the selected text in this event handler by calling getSelectedText function which may be used to determine the text to pronounce. More information on this event is available at http://print2flash.com/help/DocumentAPIEvents.php

Re: Playing a sound when clicking a text on a page

Posted: Fri Jan 25, 2008 5:34 am
by aalba
thanks for your information, but what I mean is how to Play a sound (like *.wav or *.mp3) when clicking a text or an object on a page of Print2Flash documents?

Re: Playing a sound when clicking a text on a page

Posted: Tue Jan 29, 2008 8:27 am
by staff
The problem is how you would want to detect what is clicked on a page. For example, when user clicks on a text, do you want to know the text around the cursor or just the word clicked or something else? And what would you want to know if user clicks an image?

Our suggested solution with text selection allows a user to select a specific text with mouse which you may determine in the onSelection event handler and play an appropriate MP3 file as a reaction on text selection. To play MP3 files we think you may use the standard technique as described by Adobe at http://livedocs.macromedia.com/flash/8/ ... 01565.html

Re: Playing a sound when clicking a text on a page

Posted: Thu Jan 31, 2008 5:28 am
by aalba
Suppose I just want to click an object (including texts or image, not select a text) and the object will response by giving command to .... (including ...to play an audio file or run other commands such as go to other pages).

Re: Playing a sound when clicking a text on a page

Posted: Fri Feb 01, 2008 5:15 am
by staff
Each document page is a MovieClip object composed of text, images, lines and other graphic primitives. The problem is MovieClip seems not to provide a way to enumerate its constituent objects and track clicks on them.

You may obtain a reference to the page movie instance using this undocumented method:

Code: Select all

var page1=doc.Pages[0].movie
Here the 0 index refers to the first page, the 1 would refer to the second page and so on. Then in principle you can attach an event listener to this object and track clicks on it. But as constituent objects cannot be determined, this seems to allow you to track only the coordinates of the click or the text near the click point.

Re: Playing a sound when clicking a text on a page

Posted: Fri Feb 01, 2008 8:19 pm
by aalba
the samples, please!

Re: Playing a sound when clicking a text on a page

Posted: Sat Feb 02, 2008 3:58 am
by staff
See attached an adaptation of our Print2Flash SDK Flash sample. When you click within any area of the first page, It should write to the Flash Professional output window the coordinates of the click point and the position of the text symbol near the click point (if any).