toddclare
12-13-2004, 05:25 PM
I have a one frame movie with a list component and two button components. All the code is on frame 1 of the root.
file_list.onEnterFrame = function() {
trace("File List ENTERFRAME");
if (droppedFiles == "CLEAR PUSHED" || droppedFiles == "ADD PUSHED") {
//files have been dropped
//trace("Files Dropped: " + droppedFiles);
this.addItem(droppedFiles);
trace("length = " + this.length);
}
}
When I run the movie, the output window says "File List ENTERFRAME" over and over again, as expected.
I also have a clear_btn button component, with it's own onPress that sets "droppedFiles" to "CLEAR PUSHED":
clear_btn.onPress = function() {
droppedFiles = "CLEAR PUSHED";
}
So what I expected was:
- movie fires...
- File List ENTERFRAME over and over again ...
- (I push the button) ...
- "CLEAR PUSHED, Length = 1" in the output panel
- then back to File List EnterFrame over and over agin...
when I push the button,
- I get the "Clear Pushed, Length = 1", and the list item gets added to the list
- but then the File List repetition stops and it just stares blankly at me.
- And then none of the buttons seem to do anything. If I press the Clear again, I would think I would get "Clear Pushed, Length = 2" but no response.
Any ideas? My brain is hurting...
Here's the full code, in case it helps. (I'm going to use FlashStudioPro, hence some of the commented code...)
//initialize flash studio pro scripting capability
//fspinit();
//flashstudio.setdnd_multiple("droppedFiles");
//stay on thsi frame
//stop();
//allow the user to drag and drop files into the app
var droppedFiles:String = undefined;
//set up the data providers
//var arrFiles:Array = new Array();
//file_list.dataProvider = arrFiles;
//display the right buttons depending on list selection
remove_btn.onEnterFrame = function() {
if (file_list.length == 0 || file_list.selectedIndices == undefined) {
//no items are in the list or none are selected
this.enabled = false;
} else {
this.enabled = true;
}
}
clear_btn.onEnterFrame = function() {
if (file_list.length == 0) {
//no items are on the list
this.enabled = false;
} else {
this.enabled = true;
}
}
clear_btn.onPress = function() {
droppedFiles = "CLEAR PUSHED";
}
add_btn.onPress = function() {
droppedFiles = "ADD PUSHED";
}
//watch for dropped files
file_list.onEnterFrame = function() {
trace("File List ENTERFRAME");
if (droppedFiles == "CLEAR PUSHED" || droppedFiles == "ADD PUSHED") {
//files have been dropped
//trace("Files Dropped: " + droppedFiles);
this.addItem(droppedFiles);
trace("length = " + this.length);
}
}
file_list.onEnterFrame = function() {
trace("File List ENTERFRAME");
if (droppedFiles == "CLEAR PUSHED" || droppedFiles == "ADD PUSHED") {
//files have been dropped
//trace("Files Dropped: " + droppedFiles);
this.addItem(droppedFiles);
trace("length = " + this.length);
}
}
When I run the movie, the output window says "File List ENTERFRAME" over and over again, as expected.
I also have a clear_btn button component, with it's own onPress that sets "droppedFiles" to "CLEAR PUSHED":
clear_btn.onPress = function() {
droppedFiles = "CLEAR PUSHED";
}
So what I expected was:
- movie fires...
- File List ENTERFRAME over and over again ...
- (I push the button) ...
- "CLEAR PUSHED, Length = 1" in the output panel
- then back to File List EnterFrame over and over agin...
when I push the button,
- I get the "Clear Pushed, Length = 1", and the list item gets added to the list
- but then the File List repetition stops and it just stares blankly at me.
- And then none of the buttons seem to do anything. If I press the Clear again, I would think I would get "Clear Pushed, Length = 2" but no response.
Any ideas? My brain is hurting...
Here's the full code, in case it helps. (I'm going to use FlashStudioPro, hence some of the commented code...)
//initialize flash studio pro scripting capability
//fspinit();
//flashstudio.setdnd_multiple("droppedFiles");
//stay on thsi frame
//stop();
//allow the user to drag and drop files into the app
var droppedFiles:String = undefined;
//set up the data providers
//var arrFiles:Array = new Array();
//file_list.dataProvider = arrFiles;
//display the right buttons depending on list selection
remove_btn.onEnterFrame = function() {
if (file_list.length == 0 || file_list.selectedIndices == undefined) {
//no items are in the list or none are selected
this.enabled = false;
} else {
this.enabled = true;
}
}
clear_btn.onEnterFrame = function() {
if (file_list.length == 0) {
//no items are on the list
this.enabled = false;
} else {
this.enabled = true;
}
}
clear_btn.onPress = function() {
droppedFiles = "CLEAR PUSHED";
}
add_btn.onPress = function() {
droppedFiles = "ADD PUSHED";
}
//watch for dropped files
file_list.onEnterFrame = function() {
trace("File List ENTERFRAME");
if (droppedFiles == "CLEAR PUSHED" || droppedFiles == "ADD PUSHED") {
//files have been dropped
//trace("Files Dropped: " + droppedFiles);
this.addItem(droppedFiles);
trace("length = " + this.length);
}
}