Scrollbar in AS3
I have try to use below code for create scrollbar, but it didn't work.
Can advise some method to solve this problem?
import com.tis.utils.components.Scrollbar;
var sBar:Scrollbar = new Scrollbar(testMC);
sBar.name = "ScrollBarMc";
addChild(sBar);
Thanks~
I don't know what the com.tis.utils.components package is, but it isn't part of the stock Flash install. So you might want to check any documentation that came with the Scrollbar class.
I found the code for some version of that class and it looks like it needs to create an instance of the ScrollbarAssets class -- which I don't know about either. I'm guessing it is something that should be in your library?
Other than that can you say how it doesn't work? There are many ways that things can "not work."
Similar Messages
-
Scrollbar with AS3 generated content
Hi all,
I want to use the built in Scrollbar component to scroll within a movie clip or sprite whose content is generated by a for loop within my code. I can't seem to get it working when I set the scrollbar at authortime to target the movieclip into which i place the for loop at runtime.
Thanks!
JustinThe scroll page is what I call it. So, the "scroller" contains four layers:
This is the script in the scroller:
onClipEvent (load) {
var active = 0;
var mh = _parent.Mask._height-5;
var maxmove = mh-this._height;
var amount = 0;
var fc = 0;
if (maxmove>-6) {
_parent.Scroll_Buttons._x = 1000;
onClipEvent (enterFrame) {
if (fc<80) {
this._y = Math.round((this._y-(this._y-_parent.Mover._y)*0.15));
fc++;
if (active == 1) {
fc = 0;
if (_parent.Mover._y>maxmove) {
_parent.Mover._y -= 10;
if (active == 2) {
fc = 0;
if (_parent.Mover._y<0) {
_parent.Mover._y += 10;
The Layers in the scroller:
• Mover: Nothing special.
• Mask: The mask is the layer that's shows how much of the scroll page to be shown; like x:800 and y:800.
• Page: The page is where all the objects are lined up like a long page, but still it's the mask that show's how much of this page to be shown.
• Scroll buttons (Two separate buttons: one up and one down. The behavior of the buttons when pressed is just a simple motion tween.
Here's the code in the DOWN button:
on (rollOver) {
gotoAndStop("Over");
on (rollOut) {
gotoAndStop("Out");
on (press) {
gotoAndPlay("Hit");
_parent._parent.Scrolling_Page.active = 2;
on (release, releaseOutside) {
gotoAndPlay("Up");
_parent._parent.Scrolling_Page.active = 0; -
Hey all!
I started a new flash project and accidentally chose Action Script 2 instead of Action Script 3 and didn't realize it until I had already done quite a bit of work in the timeline. Just wondering if there's an easy way to change the document type to AS3?
I tried simply using the AS3 option in the drop down menu in the actions panel, but it still gives me a syntax error when I know the code works fine in an AS3 document.
Thanks!Thank you. I tried that, but now when test the movie I get two compile errors:
WARNING: The component 'FLVPlayback' requires ActionScript 2.0.
WARNING: The component 'UIScrollBar' requires ActionScript 2.0.
And the playback does not stop at the frames I have told it to using a simple stop(); action. I know I've used a UI Scrollbar in AS3 before and I definitely know FLV Playback doesn't require AS 2.0 so maybe I need to change the settings of those components to be 3.0 components? Not sure how to do that though.
*UPDATE: Deleting the FLV and the UI Scrollbar and then adding them again fixed this problem. Obviously the components from AS2 and AS3 are much different.
On a different note, I have two other questions for you... Firstly, I've got the FLV Playback component starting off stage and sliding in to the center when the page loads. This seems to work fine in the timeline, but when I test the movie, the video remains on the right side of the stage and doesn't slide in. Any idea why?
Secondly is there a way to pause the video when you navigate to another page? Cause it keeps playing in the background (I can hear the audio still) even though I click on another page.
Thanks! -
i need to display this dynamically generating buttons from xml into moveclip with scrollbar in as3 pls help me....................i had attached my code...
var yPlacement:int = 230;
var xPlacement:int = 66;
var distance:int = 100;
var format:TextFormat = new TextFormat();
format.color = 0x000000;
format.font = "Verdana";
format.size = 18;
format.bold = true;
//format.kerning = false;
//var items:Array = new Array();
var myXML:XML = new XML();
var XML_URL:String = "evs.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
// Create the xmlLoaded function
function xmlLoaded(event:Event):void {
// Place the xml data into the myXML object
myXML = XML(myLoader.data);
// Initialize and give var name to the new external XMLDocument
var xmlDoc:XMLDocument = new XMLDocument();
// Ignore spacing around nodes
xmlDoc.ignoreWhite = true;
// Define a new name for the loaded XML that is the data in myLoader
var menuXML:XML = XML(myLoader.data);
// Parse the XML data into a readable format
xmlDoc.parseXML(menuXML.toXMLString());
// Set the index number of our loop, increments automatically
var i:Number = 0;
// Run the "for each" loop to iterate through all of the menu items listed in the external XML file
for each (var topic:XML in myXML..topic) {
// Access the value of the "itemLabel" node in our external XML file
var listLabel:String = topic.itemLabel.toString();
// Access the value of the "urlstring" node in our external XML file
var listurl:String = topic.urlstring.toString();
// Just some trace I used while testiing
//trace(listurl);
// This all pertains to the style of the button, alter values to your liking
var type:String = GradientType.LINEAR;
var colors:Array = [0xFFFFFF, 0xCCCCCC];
var alphas:Array = [1, 1];
var ratios:Array = [0, 255];
var spreadMethod:String = SpreadMethod.PAD;
var interp:String = InterpolationMethod.LINEAR_RGB;
var focalPtRatio:Number = 0;
var matrix:Matrix = new Matrix();
var boxWidth:Number = 200;
var boxHeight:Number = 40;
var boxRotation:Number = Math.PI/2; // 90˚
var tx:Number = 0;
var ty:Number = 0;
matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
var rect:Shape = new Shape;
rect.graphics.beginGradientFill(type, colors, alphas, ratios, matrix, spreadMethod, interp, focalPtRatio);
rect.graphics.lineStyle(1, 0x999999);
rect.graphics.drawRect(0, 0, 200, 40);
// This all pertains to the text fields that give our buttons their label, alter values to your liking
var myText:TextField = new TextField();
//myText.embedFonts = true;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.antiAliasType = AntiAliasType.ADVANCED;
myText.defaultTextFormat = format;
myText.selectable = false;
myText.mouseEnabled = false;
myText.text = listLabel;
myText.x = 2;
myText.y = 2;
addChild(myText);
// Create MovieClip holder for each button graphic and text label
var clip_mc = new MovieClip();
// Add the rectangle graphic
layout_mc.clip_mc.addChild(rect);
// Add the text field
layout_mc.clip_mc.addChild(myText);
// Put the new movieClip on stage now
addChild(clip_mc);
// Make the mouse button mode true for the movieclip so user knows it is a button
layout_mc.clip_mc.buttonMode = true;
// Offset each one in the loop to make sure they don't just get put right on top of each other
yPlacement = yPlacement + 50;
// Now apply it in its offset Y position to the stage
layout_mc.clip_mc.y = yPlacement;
// X position it will be placed on stage
layout_mc.clip_mc.x = xPlacement;
// Access the URL value and ready it for setting up the Click listener, and function
layout_mc.clip_mc.clickToPage = listurl;
// Add the mouse event listener to the moviClip button
layout_mc.clip_mc.addEventListener (MouseEvent.CLICK, clipClick);
//Add event listeners (used for animating the buttons)
layout_mc.clip_mc.addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);
layout_mc.clip_mc.addEventListener (MouseEvent.MOUSE_OUT, onMouseOut);
// Set the function for what happens when that button gets clicked
function clipClick(e:Event):void {
var targetURL:String = e.target.clickToPage;
var urlRequest:URLRequest = new URLRequest(targetURL);
navigateToURL(urlRequest);
i++;
// Set the mouse over function for all movieclip buttons
function onMouseOver (e:Event):void {
// Create the filters and add them to an array
var bevel:BevelFilter = new BevelFilter();
bevel.distance = 1;
bevel.angle = 45;
bevel.shadowColor = 0x666666;
bevel.shadowAlpha = 0.5;
bevel.strength = 4;
bevel.quality = BitmapFilterQuality.MEDIUM;
bevel.type = BitmapFilterType.INNER;
bevel.knockout = false;
var glow:GlowFilter = new GlowFilter();
glow.color = 0x79B3E1;
glow.alpha = 1;
glow.quality = BitmapFilterQuality.MEDIUM;
// Pack the filter paramters into the array variable
var filtersArray:Array = new Array(bevel, glow);
// Assign the filters array to the display object to apply the filter
e.target.filters = filtersArray;
// Set the mouse out function for all movieclip buttons
function onMouseOut (e:Event):void {
// Remove the Filters on Mouse Out
e.target.filters = null;NEVER MIND! I found my error. I forgot that I should have
imported MouseEvent instead of Event. I like this new way of doing
things. LOL -
AS3 - change width of ScrollBar / ScrollPane's scrollbar
Is there any way to change the width of the AS3 scrollbar
component? I've tried changing the width of the skin, but it always
snaps to the default width.I'm not sure if the original poster found an answer for this
one, but I thought I'd post this link here, as I found the answer
to this question astoundingly difficult to find
http://www.gskinner.com/blog/archives/2007/05/variable_scroll.html
Basically, you need to download the new class definition
gskinner has written and let it override the adobe provided ones.
This new class gives you some more styles to control scrollbar
width and arrow height. -
Help with AS3, loading multiple files into a movieclip in specific order in scrollbar
Hello! I am in need of some advice. We are trying to build a site with these features:
Our site will be built in Actionscript 3.
1. A navigation menu that, when a button is clicked, will scroll the site quickly to a specific Y position using swfaddress.
2. The entire site is controlled by a flash scroll bar, which will be scrolling a single movieclip.
2A. The movieclip will load content corresponding to the navigation categories, all which is organized into zipped files (using this to extract the contents of each section, example: about.zip for the about section of the site)
2B. The movieclip will load multiple zipped files one by one that correspond to the navigation, in order, making the site appear to be very tall.
**What we are in need of is understanding how to load multiple zipped files into a movie clip, in a specific order, and having them scroll between one another through the navigation. The separate navigation categories can be in movieclips instead of zipped files if that is easier.
Here is a reference of something that works like this: http://swfc-shanghai.com/#/about/Hello kglad! I have set aside the idea of using zipped files, and am now just using multiple external swfs that I'd like to load into the movieclip in a specific order. Any thoughts?
I'm new to AS3, and I'm attempting to create a scrolling movieclip that will load multiple external files, in order, into that movieclip. I'm using XML as well. At this point, nothing is loading into my movieclip (contentMain) and it's a bit frustrating! Thank you for your help!
Current error: 1180: Call to a possibly undefined method load.
AS3:
//XML Loader
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.load ("master.xml");
myXML.onLoad =function(sucess) {
if (sucess) {
contentMain.loadAll();{
load("1_Overview.swf")
load("2_Webcam.swf")
load("3_Twounion.swf")
load("4_Oneunion.swf")
load("5_Retail.swf")
load("6_Nearby.swf")
load("7_Courtyard.swf")
load("8_Map.swf")
load("9_Conference.swf")
load("10_News.swf")
load("11_Sustainability.swf")
load("12_Contact.swf")
addEventListener("complete",onLoad)
onLoad();{
//load all
}else {
trace("ERROR LOADING XML"); -
I'm having trouble both working out or finding out how to
apply an imported css file to the CS3 TextArea component. I've
frequently done this in AS2 using Flash 8, but that code no longer
works. If anyone knows could you please let me know. Here's the AS2
code I've used previously:
private function loadCss(){
var myStyle = new TextField.StyleSheet();
myStyle.load(this.CssPath+".css"); // the CssPath variable
here was supplied within an object passed through to the
constructor
textArea.styleSheet = myStyle;
loadXml();
}Thank you Anirudh,
I have been using the TextArea component because it has code to handle scrollbars, and in Flash this component is a wrapper for a TextField object. As far as I can see this is not the case in Flex, and my AS3 code sets almost all of the TextField attributes, so I probably can't use Flex and the Flash Builder anyway. At least not without throwing all my code away.
Besides, the .swf file generated seems to be much bigger than in Flash. -
How to create a Panning Tool with Mini Browser in AS3
I would like to create a panning tool similar to the attached. I looking for something very simple, I would like to be able to scroll the large image from left to right using a smaller inset browser. If anyone know of any tutorials, please inform.
Thanks for any response.Search Google for something like "AS3 custom scrollbar" You will essentially be creating a custom scrollar where the thumb of the scroller is the yellow-bounded rectangle and the smaller image it sits on is the scroller track.
-
Print data in Datagrid with AS3
Dear all,
I would want to print out all the data inside my Datagrid which were populated in flash AS3. Taking into consideration that my datagrid has horizontalScrollPolicy and verticalScrollPolicy activated, how do I print the whole information?
This is the closest code I'm looking for, but I had alot of errors when I tried to use it, maybe because it is in AS2 & i convented it wrongly...
Link: http://www.knowledgesutra.com/forums/topic/29459-print-with-flash-and-datagrids-without-re sizing/
Do take a look at the code please.
My convented code from AS2 to AS3:
import fl.data.DataProvider;
import fl.controls.DataGrid;
import fl.controls.ScrollPolicy;
var dp:DataProvider = new DataProvider();
var fitPage:Boolean = false;
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitleTestPrizeNameTestPrizeNameTestPrizeName", Prize_Name:"TestPrizeNameTestPrizeNameTestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1TestName1TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeName"});
dp.addItem({no:"1", Winner_Name:"TestName1", Prize_Title:"TestPrizeTitle", Prize_Name:"TestPrizeNameTestPrizeNameTestPrizeNameTestPrizeNameTestPrizeName"});
datagrid.columns = ["no","Winner_Name","Prize_Title","Prize_Name"];
datagrid.getColumnAt(0).width = 50;
datagrid.getColumnAt(1).width = 150;
datagrid.getColumnAt(2).width = 100;
datagrid.getColumnAt(3).width = 350;
datagrid.dataProvider = dp;
datagrid.horizontalScrollPolicy = ScrollPolicy.ON;
datagrid.setSize(600, 250);
clickme.addEventListener(MouseEvent.CLICK, clickmeFn)
function clickmeFn(e:MouseEvent){
fitPage = true;
doPrint()
function doPrint(){
if (fitPage == false) fitPage = true;
var pj:PrintJob = new PrintJob();
// position of currently visible rows stored
var prev_vPosition:Number = datagrid.verticalScrollPosition;
var prev_width:Number = datagrid.width;
var prev_height:Number = datagrid.height;
var prev_vScroll = datagrid.verticalScrollPolicy;
var prev_selectedIndex = datagrid.selectedIndex;
var dgPrintWidth:Number = 0;
var dgPrintHeight:Number = 0;
if (pj.start() != true) {
return;
// hide scrollbar for print
datagrid.verticalScrollPolicy = "off";
// hide the selection
datagrid.selectedIndex = undefined;
// datagrid width for printing
if (fitPage) {
dgPrintWidth = pj.pageWidth;
} else {
if (prev_width < pj.pageWidth) {
dgPrintWidth = prev_width;
} else {
dgPrintWidth = pj.pageWidth;
// number of rows per view, ignoring fractions (floor)
var rowsPerPage:Number = Math.floor((pj.pageHeight-datagrid.headerHeight)/datagrid.rowHeight);
// total number of pages to be printed, if there are any fractions, have one page for that (ceil)
var total_pages:Number = Math.ceil(datagrid.dataProvider.length/rowsPerPage);
// number of full pages to be printed, ignoring fractions (floor)
var full_pages:Number = Math.floor(datagrid.dataProvider.length/rowsPerPage);
// number of rows on last page if partial
var last_page_rows:Number = 0;
// height of last page if partial
var last_page_height:Number = 0;
// partial last page ?
if (total_pages != full_pages) {
last_page_rows = datagrid.dataProvider.length - (full_pages*rowsPerPage);
last_page_height = datagrid.headerHeight + (datagrid.rowHeight * last_page_rows);
// datagrid height for printing
dgPrintHeight = datagrid.headerHeight + (datagrid.rowHeight * rowsPerPage);
datagrid.setSize(dgPrintWidth, dgPrintHeight);
for (var i = 0; i<total_pages; i++) {
// if last page and partial - resize grid
if ((i == total_pages - 1) && (last_page_rows > 0)) {
datagrid.setSize(dgPrintWidth, last_page_height);
// move the visible row position.
datagrid.verticalScrollPosition = i*rowsPerPage;
// size box relative to the grid
var b = {xMin:0, xMax:datagrid.width, yMin:0, yMax:datagrid.height};
if (!fitPage && prev_width < pj.pageWidth) {
var x0 = (pj.pageWidth - prev_width) / 2;
b = {xMin:(-x0), xMax:(datagrid.width+x0), yMin:0, yMax:datagrid.height};
pj.addPage(datagrid, b);
pj.send();
pj = null;
// delete pj;
// previous scrollPolicy
datagrid.verticalScrollPolicy = prev_vScroll;
// position of currently visible rows restored
datagrid.setSize(prev_width, prev_height);
datagrid.selectedIndex = prev_selectedIndex;
datagrid.verticalScrollPosition = prev_vPosition;
The error I get when I tried to print it:
TypeError: Error #1034: Type Coercion failed: cannot convert Object@26ec1d31 to flash.geom.Rectangle.
at _fla::MainTimeline/doPrint()
at _fla::MainTimeline/clickmeFn()
Advice needed
-Zainuuvar columns:Array = ["Flash", "ActionScript", "Republic of Code"];
trace(columns);
//Start printing headers
var xPos:Number = 0;
var tbWidth:Number = 0;
//leave 2 rows margin at top
var rowY:Number = _rowHeight * 2;
for (var i = 0; i < columns.length; i++)
//define xPos by adding the tbWidth of the last loop
xPos = xPos + tbWidth;
var column:DataGridColumn = targetDG.getColumnAt(i);
//get width of this column
tbWidth = column.width;
//add textField
printClip.createTextField("header_" + i , printClip.getNextHighestDepth(), xPos, rowY,tbWidth, _rowHeight);
var thisTb:TextField = printClip["header_" + i];
//thisTb.setNewTextFormat(headerFormat);
thisTb.defaultTextFormat = headerFormat;
thisTb.border = true;
thisTb.borderColor = 0xCCCCCC;
thisTb.background = true;
thisTb.backgroundColor = 0xD5EAFF;
thisTb.text = column.headerText;
I got this AS2 code and I tried to convent it into AS3 but I have this error..
1046: Type was not found or was not a compile-time constant: DataGridColumn.
I have bold the line that causes this error. Anyone knows the solution for this error? -
Tween scrollbar error help...
Hi all,
I am having problems with a scrollbar tween on my site. I have tested the site (jessicaclucas.com) on many browsers, and it tends to work fine. But, on a Firefox browser, I think with a new version of flash player, and also when I run the Debug on Flash, I get this occasional error:
#1009: Cannot access a property or method of a null object reference.
at gs::TweenMax()
at gs::TweenMax$/to()
at index_fla::MainTimeline/tweenFinished()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at gs::TweenLite/complete()
at gs::TweenMax/complete()
at gs::TweenMax/render()
at gs::TweenLite$/updateAll()
This tends to happen if the user clicks on the scrollbar button, begins moving the scroller, and then, without clicking back on the scrollbar button to stop it, the user presses on a button on the left navigation.
I think I understand what the error is telling me, that it can't complete a function for things that are not yet on the stage. But I am not sure how to fix the code regarding the Tween to get around this.
Would anyone be willing to look over my files if I sent them?
Here is the Tween code I am using:
//Import TweenMax and the plugin for the blur filter
import gs.TweenMax;
import gs.plugins.BlurFilterPlugin;
//Tween the content to the new location.
//Call the function ResumetweenFinished() when the tween is complete.
TweenMax.to(myResumecontent, 0.3, {y: targetY, blurFilter:{blurX:22, blurY:22}, onComplete: ResumetweenFinished});
//This function is called when the tween is finished
function ResumetweenFinished():void {
//Tween the content back to “normal” (= remove blur)
TweenMax.to(myResumecontent, 0.3, {blurFilter:{blurX:0, blurY:0}});
Thanks for your help!have you got any software that mite be blocking the atempt to install the ipod stuff?? if not go to my computer right click on the cd and then click explore then copy all of the stuff from the cd and paste them in a folder outside of the cd and try opening it again (i dont no if it will work but it worked for a game i had not that long ago so its worth a try)
-
I spent all weekend looking through tutorial after tutorial.
Trying everything show to me and I still can not get a basic
slideshow with the either thumbnails or prev/next buttons to work.
It seems that every tutorial either assumes I downloaded the
correct libraries or understand when they are using AS2 or AS3.
Needless to say, I'm very frustrated and under a deadline to
get a nice slideshow across the top of our website yesterday.
Can someone point me to a "FOOL" proof tutorial or
template....I understand the basic part of what is going on but do
not know enough AS yet to hammer out the actions myself.I finally completed the tutorial to complete a flashslide
show with a scroll bar. However, I do not want a scrollbar. I would
like to be able to use next & previous buttons when clicked
take you to/from the next/previous frame in a movie clip. -
Issues converting scroll bar components from AS2 to AS3
I am working on editing a document that has scroll bar components that I would like to convert from AS2 to AS3 since everytime I try to open the document it shows a WARNING and won't convert them and when I publish and look at the final document the scroll bar seems to act unusally since it is obviously still on AS2.
Here are two of the scripts I finally was able to find within it. Should I fix it and how so? This first is for the "Creative Scroll Area" and the second is for the "Creative Scrollbar"
package {
import flash.display.MovieClip;
public class Creative Scroll Area extends MovieClip {
public function Creative Scroll Area() {
// constructor code
package {
import flash.display.MovieClip;
public class Creative Scrollbar extends MovieClip {
public function Creative Scrollbar() {
// constructor codeOkay, well I know the code is making a scroll bar and a scroll area and under the "type" it says they are "compiled..." which is unusual since most of the other components I've worked with have been movie clips or bitmaps. Do I need to look up what AS3 components I need to replace the script from above? Because when I looked for that I couldn't specifically find what I needed or really understood if I was looking at the right information.
Here is something I found when trying to "debug" it:
WARNING: The component 'UIScrollBar' requires ActionScript 2.0, which is not supported in this version of Flash Professional.
WARNING: The component 'Creative Scrollbar' requires ActionScript 2.0, which is not supported in this version of Flash Professional.
WARNING: The component 'Creative Scroll Area' requires ActionScript 2.0, which is not supported in this version of Flash Professional. -
Pls. help on AS2 to AS3 convertion for #initclip and Object.registerClass
Hi Friends,
I have converted most of the as2 code to as3 but I am stuck with the below kind of codes where the code looks like #initclip and some number next to it and inside it Object.registerClass("some reference", some reference); and ending with #endinitclip
Below is an example of what I am talking about.
#initclip 45
Object.registerClass("Border", mx.skins.Border);
#endinitclip
Thanks in advance.
With Regards,
Sagar S. RanpiseSOLVED:
Hey Friends,
I was able to solve the issue. Since no one was able to give me answer, I think most of you might not be knowing the solution.
Hence posting it below. All I have done is Added Event listener to instance name of movieclip and in the function I have imported the class the object.registerclass was refering and below import I created a new scrollbar instance and added that to my movieclip which solved the issue.
Let me know what you think?
boundingBox_mc.addEventListener(Event.ADDED_TO_STAGE, scrollbarFunction);
function scrollbarFunction(e:Event):void
// Import the class.
import mx.controls.UIScrollBar;
// Create the scrollbar
var scroller:UIScrollBar = new UIScrollBar();
boundingBox_mc.addChild(scroller);
//Object.registerClass("UIScrollBar", mx.controls.UIScrollBar); -
TextField Scrollbar with external data
If I load a textField with data using AS3, e.g. mytext.text =
"lots of text here....", and if the textField has a UIScrollBar
component attached, the scrollbar works fine in testmovie mode, and
in IE, but doesn't display in FF.
The scrollbar displays correctly if the text is included in
the textfield in the authoring environment, it only fails when the
text is added using AS, and only in FF!
Can anyone give me any insight into this problem? I don't see
any discussion of such a problem anywhere on the web so I imagine
I'm doing something wrong!The scrollbar component needs to know how much text is loaded
into the textfield so that it can work correctly. For whatever
reason, the Flash activeX control can deal with this but the plugin
doesn't work as well.
If you apply the scrollbar using actionscript, and add it to
the textfield after the text is loaded, it will work
correctly. -
hi, how to make what every child could have its own tag, but not the last one in xml?
here is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:tagfiles="*"
layout="absolute" width="630" height="400" backgroundColor="#000000"
creationComplete="init();">
<mx:Style>
@font-face {
src:url("fonts/TAHOMA.TTF");
fontFamily: Tahoma;
fontWeight: normal;
advancedAntiAliasing: true;
.Labelrec
font-family: Tahoma;
fontSize:11;
fontThickness: 200;
ScrollBar
thumbSkin: Embed(source="img/scrool_thumb.png", scaleGridLeft="1", scaleGridTop="10", scaleGridRight="14", scaleGridBottom="43");
trackSkin: Embed(source="img/scroll_track.png", scaleGridLeft="1", scaleGridTop="22", scaleGridRight="16", scaleGridBottom="153");
upArrowSkin: Embed(source="img/arrow_up.png");
downArrowSkin: Embed(source="img/arrow_down.png");
</mx:Style>
<mx:Fade alphaFrom="0" alphaTo="1" id="fin" />
<mx:Script>
<![CDATA[
import mx.controls.*;
import flash.events.Event;
import flash.net.URLLoader;
import mx.core.UIComponent;
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
import flash.events.MouseEvent;
private var _node:Object;
private var myXML:XML;
private var myLoader:URLLoader;
private var keyword:String;
private var masyvas:Array;
private var bb:VBox;
private var holder:UIComponent;
//private var _node:Object;
public function init():void {
fin.play([can]);
fin.play([myVBox]);
goTagGo();
public function goTagGo():void {
var service : HTTPService = new HTTPService();
service.url = 'data/projektai.php';
service.addEventListener(ResultEvent.RESULT, xmlLoaded);
service.send();
public function xmlLoaded(e:Event):void {
trace("xml loaded");
var result:* = HTTPService(e.target).lastResult;
for each (var tag:Object in result.tags.tag ) {
var mc = gimdom(tag);
public function gimdom(node:Object):void {
_node=node;
var myButton:Label = new Label();
myButton.htmlText = "<font color=\"#ae917c\">" + node.name + "</font>" +
" <font color=\"#a0a0a0\">" + node.text + "</font>";
myButton.mouseChildren = false;
myButton.buttonMode = true;
myButton.useHandCursor = true;
myButton.width=500;
myButton.id=node.idd;
myVBox.addChild(myButton);
keyword=node.name;
this.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
public function mouseUpHandler( e:MouseEvent ):void {
Alert.show(this._node.text);
public function mouse():void {
Alert.show(this._node.text);
]]>
</mx:Script>
<mx:Canvas id="can" width="99.9%" height="100%" horizontalScrollPolicy="off">
<mx:VBox id="myVBox" width="100%" height="100%" verticalScrollPolicy="off" y="5" x="5">
</mx:VBox>
</mx:Canvas>
</mx:Module>
function "public function mouseUpHandler( e:MouseEvent ):void {
Alert.show(this._node.text);
}" gets last xlm tagHere's a copy/paste text that you can massage into your own
personal style (maybe make it shorter, I'm too verbose), until
people get used to the change :
"That is an actionscript 3 related question, and this forum's
focus is on actionscript 1 and 2.
We now have separate forums for actionscript 1/2 (combined)
topics and for actionscript 3 topics.
What you should do:
Please edit your post in this forum (so people know it has
been re-posted) and re-post the question in the as3 forum, here:
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?catid=665
Why?: By doing this, you will get:
a) the attention of people more focused on your actionscript
3 issue and
b) it will help others looking for the answer to the same
problem in the future as they will be more likely to find it as it
will be in the correct place.
Thanks, :-)"
Maybe you are looking for
-
Rowcount is zero , but the table displays data on the screen
Hi, I have created an arraylist, which holds objects of a custom class. The custom class contains variables, that holds the data of each row. I did binding between this arraylist and a table. On the UI, the table is displayed with the data present in
-
Retrieving hierarchy fields from MDM to SAP R/3 using MDM ABAP API's
Hi all, I have developed a code to retrieve fields from MDM to SAP R/3 using MDM ABAP API's, i could retrieve all of the fields excluding the Lookup[Hierarchy] fields like- FACILITY CODE etc... please update me if anyone has any experience on thi
-
Hi all Am doing Remote instllation through Windows desptop. While installing Database instance at Database load (Porst Processing) step encountered error MSC-01004, Couldn't crate task file /oracle/SID/ora<sid>/sapdata/SAPSSEXC.TSK. Details are : Us
-
How do I crop a photo in Illustrator?
I can't believe I can't figure this out. (I came over from Freehand, and it was simple). All I want to do is: 1) Crop a placed photo within Illustrator 2) Create a border around it. I can't seem to find the answer in any help file. Is it so simple in
-
AP Express & EE Brightbox 2 Compatibility
I am in UK and my service provider is EE. I use their Brightbox 2 Fibre Broadband router and connect via wifi. I want to improve the wifi signal to my iPad when I am using it in the garden and was wondering if this could be achieved by connecting an