Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-02-2009, 05:05 AM   #1
Cera2001
Registered User
 
Join Date: Nov 2009
Posts: 3
Default [AS3] scrollpane a movie clip

I am new to actionscript 3.0 and am having problems when adding a scrollpane to my flash file. I want to scroll a movie clip. My scrollpane instance is aSp and my movie clip name is vendor_scroll. This is what I have:

import fl.events.ScrollEvent;

aSp.setSize(245, 458);

function scrollListener(event:ScrollEvent):void {
trace("horizontalScPosition: " + aSp.horizontalScrollPosition +
", verticalScrollPosition = " + aSp.verticalScrollPosition);
};
aSp.addEventListener(ScrollEvent.SCROLL, scrollListener);

aSp.source = vendor_scroll;

this.aSp.horizontalScrollPolicy = "off";

***And this is the error message I am receiving:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display:isplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/callLaterDispatcher()

Any help would be greatly appreciated!
Cera2001 is offline   Reply With Quote
Old 11-02-2009, 08:06 AM   #2
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,682
Send a message via Skype™ to henke37
Default

Did you remember to add the needed skin symbols to the library?
henke37 is online now   Reply With Quote
Old 11-02-2009, 11:49 AM   #3
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

If you hadn't already figure this out, just drag an instance of the scrollPane component onto the stage and then delete it. This will add the component to your library. I don't think you need to use the word "this" in your scrollPolicy. It should work with out that.
__________________
Damn the torpedoes! Full speed ahead.
Navarone is offline   Reply With Quote
Old 11-02-2009, 03:35 PM   #4
Cera2001
Registered User
 
Join Date: Nov 2009
Posts: 3
Default scrollpane question

The skins are in the library and the instance "aSp" of the scrollpane is on the stage. If I delete that instance my movie doesn't work since the actionscript has that instance name in it. Is there something I should change in the actionscript as well?
Cera2001 is offline   Reply With Quote
Old 11-02-2009, 03:56 PM   #5
Cera2001
Registered User
 
Join Date: Nov 2009
Posts: 3
Default

This new actionscript below made my scrollpane work. However I have a new problem now. My Flash file has 9 scenes. Once I go to the scene where the scrollpane is and then go to another scene it shows up in every scene. How do I change this?

import fl.containers.ScrollPane;
import fl.controls.ScrollPolicy;
import fl.controls.DataGrid;
import fl.data.DataProvider;

var aSp:ScrollPane = new ScrollPane();

var vendor_scroll:cat = new cat();
addChild(vendor_scroll);

aSp.source = vendor_scroll;
aSp.setSize(245, 458);
aSp.move(332, 120);

aSp.horizontalScrollPolicy = "off";

addChild(aSp);

aSp.addEventListener(Event.ENTER_FRAME, aSp_ENTERFRAME);

function aSp_ENTERFRAME(e:Event):void
{
trace("horizontalScPosition: " + aSp.horizontalScrollPosition +
", verticalScrollPosition = " + aSp.verticalScrollPosition);
}
Cera2001 is offline   Reply With Quote
Old 11-02-2009, 06:13 PM   #6
Navarone
Don
 
Navarone's Avatar
 
Join Date: Feb 2003
Location: Akron, Ohio USA
Posts: 2,077
Default

I got the same problem with my scrollPane. I am not sure how to correct it.
__________________
Damn the torpedoes! Full speed ahead.
Navarone 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 11:51 PM.

///
Follow actionscriptorg on Twitter

 


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