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 12-13-2004, 06:18 AM   #1
petefs
Fried Onions
 
petefs's Avatar
 
Join Date: Apr 2004
Location: Chicago, IL
Posts: 1,328
Send a message via AIM to petefs Send a message via MSN to petefs Send a message via Yahoo to petefs
Default problem with parameter.removeItem()

I'm working on a wizard for a component and I'm having problems clearing a parameter of type array. I've just started learning JSFL tonight, so it could certainly be a misunderstanding of the DOM : )

Here's the code that doesn't work:
PHP Code:
fl.outputPanel.clear();
var 
timeline fl.getDocumentDOM().getTimeline();
var 
currentLayer timeline.currentLayer;
var 
currentFrame timeline.currentFrame;

// get the instance of the RoboRect class
function getClassItem(className)
{
    var 
elements_array timeline.layers[currentLayer].frames[currentFrame].elements;
    var 
elements_array.length;
    while(
i--)
    {
        var 
item elements_array[i];
        if(
item.libraryItem.linkageClassName == className) {
            var 
classItem item;
        }
    }
    return 
classItem;
}

var 
RoboRect getClassItem("Jstest");
var 
drawArray RoboRect.parameters[0];
drawArray.insertItem(0"fills", [5,10,20], "Array");
drawArray.removeItem(0); 
It adds just fine -- but the remove doesn't work. If I start blank and run the script, it inserts the array. It should be removed immediately thereafter. Any hints? ^_^
petefs is offline   Reply With Quote
Old 12-13-2004, 06:53 PM   #2
splict
ruby on rails fan :)
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,139
Send a message via AIM to splict Send a message via MSN to splict Send a message via Yahoo to splict
Default

Strangely enough, I can't get any code to execute after that line. Are you having that issue, too, or am I just screwing something else up? (I don't really have a proper component to test on here)
splict is offline   Reply With Quote
Old 12-13-2004, 11:40 PM   #3
petefs
Fried Onions
 
petefs's Avatar
 
Join Date: Apr 2004
Location: Chicago, IL
Posts: 1,328
Send a message via AIM to petefs Send a message via MSN to petefs Send a message via Yahoo to petefs
Default

Nope, you're right. can't even fl.trace anything : ) if you comment the removeItem() line then it works fine.

Great, I love clearing large component parameter arrays manually every time I run the script :b
petefs is offline   Reply With Quote
Old 12-14-2004, 02:17 AM   #4
splict
ruby on rails fan :)
 
splict's Avatar
 
Join Date: Oct 2003
Location: tampa, fl
Posts: 1,139
Send a message via AIM to splict Send a message via MSN to splict Send a message via Yahoo to splict
Default

This is weird. I really wish it would just throw an error. I have managed to make it silently quit with just a trace, too. The example I'm working on chokes when trying to trace the value of the parameter's listIndex.
splict is offline   Reply With Quote
Old 12-14-2004, 03:03 AM   #5
petefs
Fried Onions
 
petefs's Avatar
 
Join Date: Apr 2004
Location: Chicago, IL
Posts: 1,328
Send a message via AIM to petefs Send a message via MSN to petefs Send a message via Yahoo to petefs
Default

well, after working on some other jsfl code I've noticed that when I tried to user the insertItem() method on a non-array/object parameter it silently failed as well. After pointing it to the proper parameter the script ran again.

This may mean that I'm simply doing something wrong with regaurds to removeItem (although I can't see how that would be). Either way silently failing is wack : (
petefs is offline   Reply With Quote
Old 12-17-2004, 11:54 PM   #6
petefs
Fried Onions
 
petefs's Avatar
 
Join Date: Apr 2004
Location: Chicago, IL
Posts: 1,328
Send a message via AIM to petefs Send a message via MSN to petefs Send a message via Yahoo to petefs
Default

For anyone interested, I found a workaround. It seems to be impossible to return the array/object parameter to an empty state -- I can, however, use removeItem at the index 1. So use this:
PHP Code:
while(drawArray.value.length>1drawArray.removeItem(1); 
and then when you want to insert new values, just access the first item as such:
drawArray.value[0].value = "your param value";
then use drawArray.insertItem() as you would normally.

It works, that's all I can ask for right now ^_^
petefs is offline   Reply With Quote
Old 12-21-2004, 05:05 PM   #7
hangalot
lala
 
hangalot's Avatar
 
Join Date: Feb 2002
Location: on the road
Posts: 2,859
Default

thanks for the sollution
__________________
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 09:57 PM.


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.