Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Extensions and Plugins > JSFL - Extending Flash

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-20-2004, 06:06 PM   #1
Kuma
Registered User
 
Kuma's Avatar
 
Join Date: Nov 2004
Location: London
Posts: 9
Default getter/setter trouble

Hi,

I'm having a little trouble with setting a variable via a getter and setter.

Basically I want to store a reference to my current selection, so that I can reset it to a previous state later in the code

But for some reason my lastSelection is always returning undefined

Could someone explain what is going on and how I could fix it please?


Thanks.
ActionScript Code:
var currSelection; var lastSelection; function getSelectionData(){     var selected = fl.getDocumentDOM().selection[0];     if(selected!=undefined && (fl.getDocumentDOM().selection.length == 1)){         if(getLastSelection() != undefined){             resetSymbol();              }               // store reference to current selection         setCurrSelection(selected);         setLastSelection(selected);     }     // I have omitted the rest of the code } // // ------------------------------------------------ //  GETTERS AND SETTERS // ------------------------------------------------ // function setLastSelection(val){     lastSelection = val;     fl.trace("setLastSelection("+val+")") } // function getLastSelection(){     fl.trace("getLastSelection(): "+lastSelection)     return lastSelection; } // // ------------------------------------------------ // function setCurrSelection(val){     currSelection = val; } // function getCurrSelection(){     return currSelection; }
Kuma is offline   Reply With Quote
Old 11-21-2004, 03:15 AM   #2
Kuma
Registered User
 
Kuma's Avatar
 
Join Date: Nov 2004
Location: London
Posts: 9
Default

Hi,
I have discovered something, which seems to be causing the issue.

I am calling a function in my JSFL file from my WindowSWF on a setInterval and it appears that the JSFL is being reloaded(?) with each event. In effect it isn't storing my references because they are being wiped.

in my WindowSWF Fla
ActionScript Code:
var nSelectionInt = setInterval(this, "getSelection", 300);

in my JSFL
ActionScript Code:
// at the top I placed a fl.trace("reloaded") // above the existing: var currSelection; var lastSelection;

and it seems to trace
ActionScript Code:
reloaded reloaded reloaded // and so on


So, my problem doesn't actually appear to be the getter/setter anymore.
It seems that the setInterval is the culprit. However, this now seems to leave me with a new issue.

How can I perform a setInterval, with out the JSFl reloading?
or
How can I store a reference to my current selection? (I imagine I'll have to pass currentFrame, currentLayer, elements* data back and forth between the SWF and the JSFL)

(*if the last option is what I have to do, how can I find out the elements index?)


Thanks
Kuma is offline   Reply With Quote
Old 11-22-2004, 09:53 AM   #3
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

yes, jsfl does not store the reference, with each call it gets reloaded. u can pass the strings identifying the selection around, but i would imagine it could get nasty. there are some other issues with setinterval from a windowswf and the selection object as well,
read this:
http://johan.plasmapudding.com/index.php?id=208
__________________
oi poloi
http://www.memorphic.com/news/
hangalot is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:11 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.