ActionScript 1/2 :: ScrollRect Without Rectangle Class

Feb 22, 2010

Is it possible to use scrollRect without the flash.geom.Rectangle class?I know the scrollRect can be used like this:import flash.geom.Rectangle; myMC.scrollRect = new Rectangle(10,10,100,100);I need to make a flash which doesn't extends outside the stage (bacause loading it from another flash will expose anything outside the stage area). Using a mask is an option, but scrollRect seems very interesting because it would be easier and give greater performance.But I can not import the flash.geom.Rectangle class (and it seems overkill to import a class just to set x,y,width and height)How can use scrollRect without the flash.geom.Rectangle class?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Class Can Add The Rectangle To The Root Stage Without Requireing The Instantiated Class To Be Added To The Stage?

May 3, 2010

I have a class called shapeC that only creates a rectangle and then addChild(rectangle);.  That class is instantiated on the main timeline.  Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);.  My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?

View 4 Replies

ActionScript 3.0 :: Detect Size Of Rect:rectangle In A Class?

Jan 29, 2010

From my main flex mxml, I am trying to detect the size of a rect:Rectangle that I created in my InfoBubble.as class. The info bubble itself is created in my InfoMap.as class. How can I access the attributes of the rectangle I created?

Here is the variable portion of the InfoBubble class:

Code:
public class InfoBubble extends Sprite
{
//public var textField:TextField;

[Code]....

View 1 Replies

ActionScript 2.0 :: How To Create Rectangle With Class File In Flash

Sep 19, 2006

How to create class files in flash. I am trying to create a rectangle with the class file here is the code also.

class hotSpotClass extends MovieClip {
function hotSpotClass(logoToLoad:String){
var myName:String;
var hotSpotX1:Number;
var hotSpotY1:Number;
[Code] .....

I am accessing all the methods working fine but the rectangle was not created. I have wrtien this code in my FLA file.
import hotSpotClass;
var testObj:Object = new hotSpotClass()
testObj.addHotSpot(5,15,45,0,1,0xffcc00,100,0x9999 99,15)

View 3 Replies

ActionScript 3.0 :: Crop Image But With Use Of Rectangle Class Or In Rectangular Shape

Apr 17, 2009

I am having some problems regarding image crop.I am able to crop an image but with the use of rectangle class or in rectangular shape.But i would like to crop in circular shape(for example go to URL...).

View 8 Replies

Actionscript 3 :: Scrollbar With Sprite And Rectangle Won't Move Text, Just The Rectangle It's Painted On?

Mar 8, 2010

For those of you still with me, I am tasked with making some scrollable content in Flash. Load in a TextFile using LoadURL(), then display it. To get the text, we've written our own class TextFieldExtended, which is basically just there to give the textfile location to the constructor and then have the class do the various steps of getting it and loading it for you.So I needed to get a Scrollbar, which I got hereThe thing is, it works with Sprites.After trying to get it to accept TextFieldExtended, I bumped into a block, since the scrollbar relied heavily on a Sprite property that TextFieldExtended didn't have or could have.

So I tried adding the TextFieldExtended instance to a Sprite instance using addchild.A problem occurs here that I do not know how to handle. It seems that a Rectangle is drawn and the Text is drawn on that. I say this because the scrollbar moves the Rectangle up and down a bit, but the text doesn't scroll, just the Rectangle it is positioned in and the text then moves along with it.My question: can this be fixed, or is does this implementation of scrollbars need a lot of adaptations before this is possible?

View 1 Replies

Actionscript 3 :: Draw A Rectangle Using The Graphics Class, But Move The Registration Point?

May 18, 2011

I have the following code to create a Sprite with a rectangle in it:

container = new Sprite();
container.graphics.beginFill(0x00CCFF, .5);
container.graphics.lineStyle(1, 0x00CCFF);[code].......

The only thing is, I'd like the registration point to be in the middle (not the top left corner). Is there a way to set up the registration point in the middle of the rectangle, but still have the position of the rectangle be correct?

i.e. not moved over so that the top left corner of the rectangle is in the "middle" of where I want the rectangle to be...

View 1 Replies

Draw Rectangle Should See Little Bold Circle To Indicate A Perfect Rectangle

May 20, 2009

I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!

View 2 Replies

ActionScript 2.0 :: Tween Class Button - User Click On The Top Rectangle And It Moves To Reveal The One Underneath It

Sep 20, 2007

i am creating a simple set of a few rectangles stacked on top of eachother (going to be like a stack of postcards) and i want to have the user click on the top rectangle and it moves to reveal the one underneath it. i have it all set up to work except i can't think of a way to stop it from being clickable after it's been moved to the side and the 2nd rectangle is revealed. does this make any sense? here is my code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Move A ScrollRect Up And Down Using The Mousewheel?

Aug 11, 2009

I'm trying to move a scrollRect up and down using the mousewheel. that part i've got fine but now i wanted to add easing and am not sure on the maths..

ActionScript Code:
function handleMouseWheel(event:MouseEvent):void {
var rect:Rectangle = this.scrollRect;
var scrollSpeed:int = 10;

[code]....

View 0 Replies

ActionScript 3.0 :: Bitmap Limits With ScrollRect In 3D?

Oct 19, 2009

If we have a Bitamp with more than 16777216 pixels (or one side larger than 8191 px) Flash 10 doesn't show it (Flash 9 and earlier has smaller limits even).One solution to this is to use scrollRect to limit the size displayed.OK, that works.

But Flash 10 has another problem, if we use any 3D property (rotationX, z, etc), flash transforms your MC in bitmap, so we can reach the above limit even when we are not working with bitmaps...A bigger problem is that although our MC could be really small (at least less than 16777216 pixels), when we apply a 3D transform like rotationX, the displayed MC can grows enough to reach the limit. And... we can't use scrollRect with 3D MC. But we have a trick here too, there are two ways to use scrollRect with 3D:

1. Create a 2D parent, then create the 3D displayObject inside of that parent.
2. Set cacheAsBitmap to true for the 2D parent.
3. Create a grandparent container to hold the first two items.
4. Set cacheAsBitmap to true for the grandparent container.
5. Apply scrollRect to the grandparent container.

These methods are really differents, with the second I couldn't use scrollRect to avoid reaching the bitmap limit. I think that's because in the second we apply scrollRect to the parent and 3D to the child, so nothing breakes our child from growing.With the firs method we apply scrollRect to the child, and the 3D property to the parent.

Code:
var p: Sprite = new Sprite();
var c: Sprite = new Sprite();
p.addChild(c);

[code]....

View 0 Replies

ActionScript 3.0 :: Object Moves With Scrollrect?

Aug 18, 2011

I have a scrolling background that is 1320 x 1000 big. I'm using a sprite as a container where my background canvas is placed inside of it. Additionally I add (via addChild) a score sprite inside of the background sprite (the one that holds the bg canvas so the score appears on top of the bg canvas).The goal is that when I add a score it shall be stuck to the background (even when the scrollrect moves; it shall have a fixed position on the background).The problem is that this doesn't work because when the score appears it moves with the scrollrect and this is not what I want. I already tried it with globalToLocal but had no success yet. Probably because I don't really understand globalToLocal (and vice versa)These are some code excerpts:

Code:
private var backgroundBitmapData:BitmapData = new BitmapData(1320, 1000, false, 0x000000);
private var canvasBitmapData:BitmapData = new BitmapData(1320, 1000, false, 0x000000);

[code].....

View 7 Replies

ActionScript 2.0 :: Scrolling ScrollRect With A ScrollBar?

Jun 5, 2008

I have some actionscript, and it scrolls the scrollRect, but there is a catch. It doesn't completely scroll it. It lets me scroll down until it's halfway and stops. I can still scroll up to the top, but the problem is unerving. I can't find a fix for it.

[Code]...

View 2 Replies

ActionScript 3.0 :: Convert Rectangle To Curved Rectangle?

Aug 2, 2011

I am trying to convert a rectangle(actually multiple rectangles) to a curved rectangle. I think it should be pretty easy but I guess i am stupid. Basically I would have a start position and stop position (many of these), and they would be converted to curved rectangles and follow in a cicrle around.

View 0 Replies

ActionScript 3.0 :: Creating A Rectangle Inside Of A Rectangle?

Jun 26, 2010

I would like to create a rectangle inside of a rectangle, starting approximately 15% inward from the right side of the other rectangle.

I know how to create rectangles with:

Code:
var newHotRect:MovieClip = new MovieClip();
newHotRect.graphics.beginFill(0x00FF00);
newHotRect.graphics.drawRect(0, 0, 100, 100);
addChild(newHotRect);

But how would I make another rectangle on top of that (the black one pictured) that is approximately 15% from the right?

I toyed around with .right, and .bottomright with no success. Can anyone lead me in the right direction? or even finding the x and y of the upper right or bottom right side of a rectangle?

View 10 Replies

ActionScript 3.0 :: Rectangle To Rectangle Collision Response?

May 20, 2011

how to respond when a rectangle hits another rectangle? I already know how to detect the collision, I just don't know how to respond to it. I'm just trying making a simple side-scrolling platform game where I have platforms I can walk on and bump against on all sides. I have searched everywhere and just can't find the tutorials I'm looking for.

View 6 Replies

ActionScript 3.0 :: Scrollrect Vs. Mask: Smooth Movement?

Jan 27, 2009

There are two basic ways of panning a view in Flash. One is to move the display object (and use a mask if necessary). The other is to use scrollrect. Today I noticed a small, but annoying effect of scrollrect. Scrollrect's can't have true Numeric positions-- they are automatically snapped to the nearest pixel.

When moving at very slow speeds, the effect is noticeable. In this example you can switch between two modes of panning, sprite movement with mask and scrollrect:

http://lab.wx3.com/scrolltest/ (view source enabled).

In the default mode, the circles move smoothly.

In scrollrect mode, the circles seem to stutter because the scrollrect is snapping to the nearest pixel.found a way to make a scrollrect move smoothly at slow speeds?

View 3 Replies

Actionscript 3 :: Caching - Moving ScrollRect With CacheAsBitmap?

Aug 30, 2011

in order to increase performance of a scrollRect i must cache the vector as a bitmap, otherwise the scrollRect will be simply a less performant mask (info source).however, i can't seem to move an object/scrollRect once i've applied cacheAsBitmap. why?

package
{
//Imports
import flash.display.Screen;
import flash.display.Sprite;

[code].....

View 1 Replies

ActionScript 2.0 :: ScrollRect - Unable To Upload A File?

Jun 19, 2009

I am having a problem with ScrollRect. I am unable to upload a file( i don't know why..i am getting upload error msgs). So i have quoted the code.

ActionScript Code: import flash.geom.Rectangle;   
var container:MovieClip = container_mc;//container_mc is in timeline(its widht is 600 )
var window:Rectangle = new Rectangle(0, 0 , 400, 100);
container.scrollRect = window;   
container.cacheAsBitmap = true;

[Code]...

Currently the leftmost part of movieclip is visible. I want to make right most part of movieclip to be visible at first. What should i do ?

View 2 Replies

ActionScript 3.0 :: Redraw Invalidation With ScrollRect Vs GetBounds?

Mar 24, 2011

I'm having a problem that involves scrollRect and getBounds. In short, getBounds is reporting an old value not accounting for scrollRect changes during that frame. Example:

ActionScript Code:
var shape:Shape = new Shape();
shape.graphics.beginFill(0);

[code].....

View 3 Replies

ActionScript 2.0 :: HitTest On Mc Doesn't Work With ScrollRect?

Oct 29, 2006

I have two pieces of code, that won't work together.First: this makes a hitTest on an mc to make it run on rollover:

Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (this._currentframe<this._totalframes) {
nextFrame();

[Code]...

Each work seperately, but they won't together. How do I get around this?

View 7 Replies

IDE :: ScrollRect Causes Motion Tween On Timeline To Stop?

Jul 1, 2009

I'm having trouble using a scrollRect on an object instance on the timeline that has a motion tween. As soon as I apply the scrollRect to it, the object just stops! I've attached a simple fla that shows what I'm talking about.

Simply comment out this line in the first frame's actions to see the oval move across:

Code:
oval1.scrollRect = window;

The actual application I'm making is using a scrollRect on a custom list control, where each item in the list is a symbol in the library. It works great, except if I try to move my list around using a motion tween (the list still works, but the list doesn't move in the motion tween). As soon as I remove the code to apply the scrollRect, it works but the list fills the screen!

View 1 Replies

ActionScript 3.0 :: Flash Object Moves With Scrollrect?

Aug 18, 2011

I have a scrolling background that is 1320 x 1000 big. I'm using a sprite as a container where my background canvas is placed inside of it. Additionally I add (via addChild) a score sprite inside of the background sprite (the one that holds the bg canvas so the score appears on top of the bg canvas).

The goal is that when I add a score it shall be stuck to the background (even when the scrollrect moves; it shall have a fixed position on the background).

The problem is that this doesn't work because when the score appears it moves with the scrollrect and this is not what I want. I already tried it with globalToLocal but had no success yet. Probably because I don't really understand globalToLocal (and vice versa).

These are some code excerpts:

Code:
private var backgroundBitmapData:BitmapData = new BitmapData(1320, 1000, false, 0x000000);
private var canvasBitmapData:BitmapData = new BitmapData(1320, 1000, false,

[Code].....

View 1 Replies

ActionScript 2.0 :: ScrollRect And Browser Resizing - Panning Doesn't Go With It

May 28, 2008

I'm trying to make a full browser webpage that utilizes the scrollRect type of class to pan around a movieclip that contains other movieclips and so on. The problem I run into is that when the browser window is resized that panning doesn't go with it. So panning to all the edges becomes impossible. I've tried a bunch of different stage resizing techniques but none of them give any good results. Here's the actionscript I'm currently working with:

[Code]....

View 4 Replies

ActionScript 3.0 :: FP 9: Fullbrowser Images Transition From Left To Right Using Scrollrect LAGS?

Mar 11, 2009

hi guys, basically quick rundown is:

1. container1-->bitmap image with bitmapData.
2. container2-->bitmap image with bitmapdata.
3. im using the latest tweenmax
4. have correctly added a 2 seperate scrollrects to container1 and container2 that takes the width and height of the stage.
5. tweenmax is only moving the rectangles.

I get the effect i want, however, it still lags a choppy animation. Anyone know how come?

View 3 Replies

IDE :: Oval / Rectangle Tool And Oval / Rectangle Primitive Tool

Nov 14, 2010

I do know how to use the oval / rectangle and oval / rectangle primitive tools in the tool bar and find them quite useful, but one thing I find confusing is. A oval / rectangle primitive object can be edited later but the oval / rectangle can't. So the point is,how do we use them properly ? when to use ? Why does Adobe Flash still keep the oval / rectangle tool in their product instead of removing them with the oval / rectangle primitive tool ?

View 2 Replies

Map Trapezoid To Rectangle?

Jan 28, 2011

How can I map a trapezoid to a rectangle?

Do you have any AS3.0 code about mapping? Or a formula for mapping?

View 2 Replies

ActionScript 3.0 :: Determine The X Value Of A Rectangle?

Mar 18, 2009

I am creating 6 rectangles through a loop like this:

var target:Array = new Array();
for (var i:Number = 1; i < 7; i++){
target
= new Sprite();
target.graphics.lineStyle(0,0,1);

[Code]...

View 6 Replies

Flash :: Why This Rectangle Is Not Drawn

Aug 13, 2010

public class Greeter extends MovieClip
{
public function Greeter()

[code].....

View 3 Replies

IDE :: Rectangle Around Textbox And Images?

Jan 21, 2009

My question applies only when I work in 16 bit system resolution, so when I apply some text and apply 'Anti-alias for readability' with embedded chars, there is some strange filled rectangle showing around the text box. The same applies when I add any kind of filter to a text or image. You may see the exact problem by clicking on the link below: http:[url]....

- Notice the rectangle around the text boxes ('anti-alias for readability' applied, it doesn't matters is it static or dynamic text)

- Notice the rectangle around the middle dark-gray box with glowing effect applied

I will say again, this problem occurs only in 16 bit system resolution, it is not applying in 32 bit.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved