View Full Version : Scroll Pa|nes :)
junkster
06-09-2003, 11:10 AM
Hi,
I know the whole scroll pane as been gone over a few times. But in my case I have created the mc to go in the scrollpane in AS.
Problem is i cant attach the scrollpane to the mc. I have tried loads of different ways of doing it but it wont attach :(
This is the movieclip that I need to add a scrollpane too.
_root.createEmptyMovieClip("menubody", 1);
This is the AS I have been using to attach the scrollpane.
attachMovie("FScrollPaneSymbol", "scrollpane", 2)
_root.scrollpane.setScrollContent("menubody");
_root.scrollpane.refreshPane();
Can anyone help ??
Thanks,
J
CyanBlue
06-09-2003, 06:11 PM
Howdy and Welcome... ;)
The thing you have to remember is that the ScrollPane instance should be attached to the stage BEFORE you create the movieclip... That's all!!! :)
Try this... and pay extra attention to the bolds..._root.attachMovie("FScrollPaneSymbol", "scrollpane", 1)
_root.createEmptyMovieClip("menubody", 2);
_root.menubody.beginFill(0x0000FF, 100);
_root.menubody.lineStyle(3, 0xFF0000, 100);
_root.menubody.moveTo(15, 15);
_root.menubody.lineTo(200, 15);
_root.menubody.lineTo(200, 175);
_root.menubody.lineTo(15, 175);
_root.menubody.endFill();
_root.scrollpane.setScrollContent(_root.menubody);
_root.scrollpane.refreshPane();
NetScamp
08-16-2003, 04:41 PM
what if you just have the scroll pane on stage, it has been dragged there from the component library, and has been given an instance name ?
CyanBlue
08-17-2003, 11:55 AM
Howdy... ;)
Can you be more specific??? What about it???
Tell us what's not working and show us some codes if possible...
;)
freddycodes
08-17-2003, 01:36 PM
You just do it the same way, you already have the instance name though. I assume the problem comes when trying to add stuff to the clip in the pane. I use getScrollContent() to get a reference to the clip in the pane, and then add stuff to it. See attached
flashdudette
08-25-2003, 06:50 PM
I thought I'd ask my question here about a dynamically created menu (thanks to a sample from another forum by Jonathan Harris & James Rimell).
I just added the progress stuff (checkmark...) to it to fit my purpose. Now here is my question:
How could I make the scrollpane work when my menu has many links and is too long to fit in the space where it is.
See attached menu without the scrollpane.
CyanBlue
08-25-2003, 09:58 PM
Howdy... ;)
What do you mean by this???How could I make the scrollpane work when my menu has many links and is too long to fit in the space where it is.Is your menu system within the ScrollPane or the content of the menu being opened within the ScrollPane???
If it is the former, are you asking what you should do when the generated menu is, say, 200 pixel long when the ScrollPane is 150 pixel long??? Then you just make sure that your menu system is fully generated by reading the content of the external text file, and when it is fully generated, you can safely add it into the ScrollPane to make sure that you are getting the scrollBar for the ScrollPane to move up and down...
But I don't know if it is a good practice, in terms of usability, to add the menu within the ScrollPane when it might be longer than the ScrollPane itself... I'd avoid using it that way if possible... Just my 2 cents... :)
flashdudette
08-26-2003, 10:04 AM
Well CyanBlue, did you look at the menu? Let's say I have 100 links. Obviously the menu will be very long, down and yonder the screen even. So, I was thinking about putting it in a scrollpane so I could just scroll down. Well i tried that but when I add the scrollpane, the menu is not generated. Maybe I am adding it at the wrong time???
I was thinking that maybe there was another way to add scrolling to my menu, though if the scrollpane does not work. Maybe I should troncate it some way and have submenus. I'll be thinking about that too.
CyanBlue
08-26-2003, 11:45 AM
Yeah... I have taken look at the file... It was nice one, but I cannot really imagine 100 menus of it... :D
If you have a sample that shows the problem with the menu not being generated, I'll take a look at it...
But I think you might just want to use combo box as an alternative if that could work with what you have... Just my 2 cents... ;)
flashdudette
08-26-2003, 12:14 PM
To tell you the truth I have no clue how to make it work.
I just put a scrollpane on the stage with the movieclip. Of course I get the scrollpane and the movieclip inside - just one since teh target field is the linkage name and also the menu with all its links above it.
I suppose I have to attach the menu after it is built into the scrollpane.
But I'm going to check into the comboBox too. I did not even think about that! Duh...
But I do not like the comboBox looks though....
flashdudette
08-26-2003, 01:05 PM
Come to think about it, even if I could load my links into a comboBox, I would not be able to track the user's progress with a checkmark, could I?
flashdudette
08-26-2003, 01:23 PM
I got the urls in the comboBox - that's some progress. Do you think I could have some way to put a checkmark in there to have the user's progress?
flashdudette
08-26-2003, 06:09 PM
Ok - Using the combobox I was able to load into it the data I need
the value 0,1 and 2 for the user progress, the name of the link and the link.
Next step, I am wondering about: how coud I get my progress values to be and empty string, a checkmark, a cross?
CyanBlue
08-29-2003, 09:03 PM
Howdy... ;)
Sorry... I was totally ignoring you... :p
Nah, I wasn't, but somehow it looks like I did... I was just busy, sorry...
What about this one???
I think this one is almost closest one I can think of and this one gives you lots of things to learn... ;)
http://www.macromedia.com/devnet/mx/flash/articles/extending_components.html
flashdudette
09-02-2003, 12:18 PM
CyanBlue, you don't have to answer all my questions. You don't owe me anything! I am just glad that you've help me so many times before but I understand that people have other things to do besides attending to my many questions.
Anyway, I am working on the listbox with the article you mentioned. Indeed it looks like the way to go.
I'll let you know if I succeed to implement it in my project.
Thanks :D
flashdudette
09-02-2003, 02:58 PM
In the Macromedia example, could you explain this line to me?
this.icon_mc.gotoAndStop((itmObj.data=="happy") ? 1 : 2);
I understand that depending on the value of the data (happy or sad) frame 1 or 2 are viewed but I don't quite understand the syntax. What does the "?" stand for and the ":"? And if I am choosing between 3 frames, how should I format it?
freddycodes
09-02-2003, 03:14 PM
Its the ternary operator.
expression ? true : false
So if the expression is true whats right after the ? is evaluated, and if false after the colon.
flashdudette
09-02-2003, 03:51 PM
Thanks! I now can see why I could not make it work the way I wanted.
CyanBlue
09-02-2003, 04:47 PM
CyanBlue, you don't have to answer all my questions. You don't owe me anything! I am just glad that you've help me so many times before but I understand that people have other things to do besides attending to my many questions.flashdudette hates me... Bua~~~~~~ :mad:
Well... I am in the middle of something these days so I cannot really go over all the threads like I used to do... But I get the email notifications for all the threads that I have subscribed, and I've got this one the other day and I saw you posted another interesting question, so I just added my few cents, that's all... :DThanks! I now can see why I could not make it work the way I wanted.So... Did you solve the problem??? ;)
flashdudette
09-02-2003, 05:18 PM
Assuming that the data value could be 0,1 or 2, could this line of code be replaced by:
[as]
if (itmObj.data == "happy") {
flashdudette
09-02-2003, 05:31 PM
Oops, my previous post posted before I was finished.
Where did you get the impression I hated you ??? You're one of my heros with FreddyCodes and some others!
No I have not solved the problem though the article looked very promising? I'm slow and not very smart!
In the MM example, the icon state is defined by the data value. Only in my listbox, the data value is a url. I know I can put more than one thing in data, but then that really complicated things.
I tried different ways to get this to work but... well, I'm stuck!
I'll let you know If I solve this?
CyanBlue
09-02-2003, 05:49 PM
Well... If you have three items, you can add one more of that (condition) ? val1 : val2 within it like...(condition1) ? ((condition2) ? val1 : val2) : val3but you can make things whole lot easier to human eyes by doing this...if (condition1) variable = 1;
else if (condition2) variable = 2;
else variable = 3;
this.mc.gotoAndStop(variable);(Hm... What happened to [ AS ] tag while I was gone??? :confused: )Where did you get the impression I hated you ???Mommy!!! Now, she's mad at me... :pI'm slow and not very smart!I don't think that's entirely true... Slow part, I cannot really say it cuz I haven't seen how you do it, but the latter, I don't think that's true... ;)the data value is a url. I know I can put more than one thing in data, but then that really complicated things.Um... This part I am not really getting how you want the things to be, but if you just want to add multiple things in one data field, you just need to add some seperator like '|' and split them later...
flashdudette
09-03-2003, 02:43 PM
Got it to work after reading some info on the MM forum.
Needed to set a dataprovider in order to have both the icons and the url working together.
Basically if you have more that 1 data, you need to set a dataprovider.
// create array for dataprovider
LB1 = new Array();
for (var j=1; j<=numberofItems; j++){
myItem = new Object();
myItem.label = items[j];
myItem.data=items2[j];
myItem.urls=urls[j];
LB1[j]=myItem;
}
// set data provider
Menulist.setDataProvider(LB1);
// set change handler
menuList.setChangeHandler("loadSite");
// change handler
function loadSite(component) {
var SiteURL = component.getSelectedItem().urls;
getURL(SiteURL, "_self");
}
stop();
CyanBlue
09-04-2003, 08:18 AM
Ah!!!!!!!!!!!!!!!!!! I hate the code... I want to see something in action... :pBasically if you have more that 1 data, you need to set a dataprovider.Hm... I don't think that's the only way to do it, but then what do I know??? I have not touched Flash more than a month already... :D
flashdudette
09-04-2003, 10:44 AM
I would have uploaded the file only the zipped file of 158 k- so forget it! If someone wants to check it they'll have to send me a PM. :)
As far as doing it some other way, be my guest. I am sure you could post something different that would be helpful for others.
:D
CyanBlue
09-04-2003, 03:10 PM
Got a sample uploaded somewhere on the net that we can just type in to see how it looks like, maybe??? :D
Me, inventing another wheel??? Me, lazy boy??? I do not think so... :D
flashdudette
09-05-2003, 11:48 AM
FYI:
I added the separator clip into the FcustomItem and then I added the following lines for the blue separator to fit the width of the listbox:
FCustomItemClass.prototype.layoutContent = function(width) {
this.attachMovie("FLabelSymbol", "fLabel_mc", 2, {hostComponent:this.controller});
this.fLabel_mc._x = 18;
// added icon to the left side
this.icon_mc._x = 2;
// added blue line to separate each listing
this.separator._x = 2;
this.separator._width = width;
this.fLabel_mc.setSize(width-7-this.icon_mc._width);
this.fLabel_mc.labelField.selectable = false;
};
xmiinc
09-10-2003, 07:12 PM
freddycodes, I'm really curious about a statement you made earlier in this thread: "I use getScrollContent() to get a reference to the clip in the pane".
What "clip" are you referring to? I've been studying the differences between get and setScrollpane() for a good part of the afternoon. Is it something that is already a part of the component by default? Something that's already there that you can use as a target? I've had no luck using either get or setContent() so far, but then I may not be understanding what I'm dealing with completely. Scrollpane has turned out to be the biggest pain in the many months I've been using AS...its totally kicking my ass.
freddycodes
09-10-2003, 07:49 PM
After you use setScrollContent, using getScrollContent() reutrns a reference to the clip that you assigned as the content of the pane. So you can add stuff to it, or modify stuff in it.
xmiinc
09-12-2003, 05:16 PM
thanks, freddycodes...the distinction did finally become obvious when I looked at some other code that used both methods (a moment of brain-lock perhaps?) On the other hand, you might be interested in another thread on scrollpane usage over in Actionscripting that has nearly as many responses as this one, dealing with a specific code-block that gives me bizarro results. Maybe you can spot something we've missed?
diegobravo
01-11-2005, 09:22 PM
in flash i create a button. but how can i link it to a website. please help and email to diego_bravo13@yahoo.com. thank you :confused:
diegobravo
01-11-2005, 09:24 PM
How can i link a website to a button i have created.
CyanBlue
01-11-2005, 11:32 PM
Howdy and Welcome... :)
What's that question got to do with the scrollPane component???
If you are asking if you could load the website into the scrollPane as iFrame does, nope that won't happen in Flash...
flashdudette
01-12-2005, 02:07 PM
If it is just to send a user to a website from a button to methods:
1- click on button and add code to load url into a new window:
on (release) {
getURL("http:yourwebaddress.com", blank);
}
or give a name to the button instance and add code on main time line (not button timeline). Let say we call it myButton
myButton.onRelease = function() {
getURL("http:yourwebaddress.com", blank);
};
I am not sure it was teh question - Let me know!
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.