activate floatbox via flash button

Page: 1

Author Post
rctong
Guest
Does anyone know if it is possible to initiate a floatbox photo gallery from a flash button inside a swf flash file. How do i go about doing this?

Thanks
Ryan
Administrator
Registered: Aug 2008
Posts: 3382
on(release) {
getURL("javascript:fb.loadAnchor('myPhoto.jpg')");
}


...or...

on(release) {
getURL("javascript:fb.start(document.getElementById('myGalleryId'))");
}

where 'myGalleryId' is an ID attribute placed on the floatbox-enabled anchor associated with the gallery item you want to start.
rctong
Guest
Thanks.

Are there any special scripts that need to be added to the html file?

Also, do i still call out the pictures in the html between the <a> tags but just keep them invisible?

For example: <a href="images/image1.jpg rel="floatbox[group]" title="image title"></a>
Administrator
Registered: Aug 2008
Posts: 3382
That looks almost right. To use the fb.start method, you need an anchor to start, but that anchor doesn't need to show anything on the page. I.e., it can be empty. Add an id and you're ready to go.

<a id="something" href="images/image1.jpg rel="floatbox[group]" title="image title"></a>
rctong
Guest
I know lightbox++ requires additional java scripting to be added to the html file in order to get the flash button & lightbox working properly.

Please see
http://blog.codefidelity.com/?p=16

So you are saying that floatbox does not require anything additional? i just need the following? 1. added to Flash swf. and 2 & 3 added to html file?

1. on(release) {getURL("javascript:fb.loadAnchor('myPhoto.jpg')");}
2. <a id="something" href="images/image1.jpg rel="floatbox[group]" title="image title"></a>
3. the default floatbox settings as described in the quickstart/installation.
Administrator
Registered: Aug 2008
Posts: 3382
Not quite. It's an either/or situation. There's two ways to do it. Pick one.
One is to use the fb.loadAnchor function with text parameters and the other is to use the fb.start function with a getElementById call. So you pick one of the two approaches from my first response. They're both quite simple and work "out of the box".

The fb.start approach allows you to group the started item with a gallery set based on matching rel attributes. The fb.loadAnchor approach can only load a stand-alone item, but that may be all you need.
Member
Registered: Apr 2009
Posts: 31
I'm having issues calling a div from flash. doesn't seem to work with this:

call from flash:
getURL(javascript:fb.start(document.getElementById('myID')));

html div:
<div id="myID" rel="floatbox" rev="width:484 height:443">some text</div>

Nothing is happening and I'm not getting an JS errors.
Administrator
Registered: Aug 2008
Posts: 3382
floatbox doesn't attach to div elements. It attaches to anchor <a> elements. And fb.start() is expecting a floatbox-enabled anchor to be passed to it, not a div.

What you want is something like:<a id="myID" href="myContent.html" rel="floatbox" rev="width:484 height:443"></a>

The docs can give you info about pointing the anchor's href to a hidden div if that's what you want to do.

As an alternative to fb.start, you can can use fb.loadAnchor('myContent.html', 'width:484 height:443'). Whichever approach you use, the href 'myContent.html' is a pointer to your content, not your content itself.
Member
Registered: Apr 2009
Posts: 31
perfect! I got it - thanx

Page: 1