ActionScript 3.0 :: Changing Gradient In Sprite From Library

Apr 4, 2009

I would like to be able to make changes to a colour gradient of a sprite from my library, as opposed to one drawn dynamically. So the code I thought would look something like this:

Code:
var radType:String = GradientType.RADIAL;
var radMatrix:Matrix = new Matrix();
radMatrix.createGradientBox(120,120);
var radColours:Array = [0x3174d0, 0x15396f];
var radAlphas:Array = [1, 1];
var radRatios:Array = [0, 255];
var myLibrarySprite:spriteInLibrary = new spriteInLibrary();
myLibrarySprite.graphics.beginGradientFill(radType, radColours, radAlphas, radRatios,radMatrix);
addChild(myLibrarySprite);

I've been using essentially this code (plus a bit for say drawing a square) happily to gradient fill sprites that are dynamically drawn. I don't get any errors from this.
I have tried adding myLibrarySprite.graphics.clear() but that does not make a difference.

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Created A Sprite Gradient Box As Background?

Apr 10, 2009

I have created a sprite gradient box as my background in my flash as3 file (using tweenmax). As i'm trying to make this a full screen swf on the browser window, i set the width and height according to the stage.

My trouble is that when I resize my browser, the gradient box does not resize with it... it only does when i refresh the window with the new width/height.

Is there a way I can put a redraw function in an event handler that will recognize the window resize? If this is hard to understand... can my background become bigger at the same time as the window is being dragged to a new size?

[Code]...

View 3 Replies

ActionScript 3.0 :: Flash Sprite Gradient Mask AS3

Sep 10, 2010

I have created a Sprite that contains 3 movieclips that act as masks for another movieclip. 2 of the moviclips have an alpha gradient but I cannot get the alpha to work. I have the three masks because they are separately animated.Here is my code.

var maskContainer = new Sprite();
maskContainer.addChild(WebPageMaskEndT_mc);
maskContainer.addChild(WebPageMaskEndB_mc);[code]....

NOTE: I have also tried setting cacheAsBitmap for the 3 individual masks but no results.

View 2 Replies

ActionScript 2.0 :: Changing The Existing Gradient?

Jan 28, 2007

I have a movie clip called volumecontrolbackground_mc that has a gradient in it. on rollover I want it to change the color of the gradients and on roll out go back to the default values. Any pointers on how I would accomplish this? I have seen the methods where you create a new movie clip and fill it with a gradient but none where you modify a existing gradient.

View 1 Replies

ActionScript 2.0 :: Changing The Value Of A Gradient Fill?

Dec 9, 2003

I'm trying to programmatically change the value of one of the colours in a gradient fill of a symbol with Actionscript.

I've used setColor for the main part of the symbol now all i need is to change the gradient fill to match it.[URL]

View 11 Replies

ActionScript 3.0 :: Changing Color Of MovieClip To Gradient

Jul 8, 2009

I was wondering if there was anyway of changing the internal colour of an mc to a gradient?

View 3 Replies

Flash :: Create A Vertical Color Gradient (or Any Other Angle Besides A Flat Horizontal Gradient)?

Mar 2, 2010

my first time trying to draw a multi-color gradient in actionscript 3. So I got this code from the help docs, but I can't seem to get a vertical gradient, whatever formula or number I use for rotate, it stays stuck on the default horizontal gradient :(

[Code]...

View 3 Replies

ActionScript 3.0 :: Flash : Create Gradient Fill, Transparent Background And Radial Gradient?

Dec 26, 2011

I'm trying to create spinning rays in actionscript to use in my website.Below is the rough idea of what i'm trying to create.Is it possible to create absolutely with 0 images.Following is the actionscript code in which i couldn't figure out how to add gradient, transperant background and little radial gradient to create glow effect.

Code:

function CreateRays():Shape {
var ray:Shape = new Shape();
ray.graphics.beginFill(0xFF9900,.5);
ray.graphics.lineStyle(1,0xFF9900,.5);

[code]....

If you paste above code in 1st frame of your scene with nothing on your scene, it will give you sweet rotating rays!

View 2 Replies

ActionScript 3.0 :: Load Into Another Swf And Add To A Sprite From The Library?

Jan 2, 2011

I have a swf that I load into another swf and add to a Sprite from the library.  The Sprite is enabled for drag/drop so I can move the loaded swf and that part works fine .  On the imported swf is a scrollbar it no longer works. I

[Code]...

View 9 Replies

ActionScript 3.0 :: Sprite Becomes Blurry When Changing RotationZ?

Oct 28, 2009

Does anyone know what might be causing this?  Perspective angle seems to have no affect.

View 3 Replies

ActionScript 3.0 :: Values Of Mouse X / Y Changing For Same Sprite?

Jan 2, 2010

I'm confused that values of mouseX&Y properties for a same sprite are changing as its scaling (when you make scaleX out of 1.0). I would like to know the precise mechanism (or detailed definition) of MouseX, MouseY property.

View 6 Replies

Actionscript 3.0 :: Changing Sprite Line Color?

Jan 31, 2009

Is it possible to smoothly change the color of the line in this sprite over a period of time?Code: Select allvar sp:Sprite = newSprite();addChild(sp);sp.graphics.lineStyle(3, 0x31FF1A);I saw a bit of code that used Tweener to do this with a movie clip, but I can't make Tweener work with a sprite.

View 3 Replies

ActionScript 3.0 :: Sprite Loader From Library Onto The Stage?

Jan 30, 2009

Loading a Sprite or MovieClip from the library to the Stage is simple. You just export the symbol and do the following code:

var mySp:Sprite1 = new Sprite1();
addChild(mySp)

assuming the exported sprite is called "Sprite1" and the base class is flash.display.Sprite

But what if you have many sprites and want to encapsulate this into a function with the sprite name passed as a string? What would the code in the function look like? Somehow you have to cast the string as the name of the sprite class defined in your export but I'm not sure how. I've seen a sample using the "as" keyword but try searching "as" in the help you you don't get much help.

Code:
function loadSpriteFromLibrary(sSpriteName:String)
{
//load the sprite with an exported name passed into sSpriteName onto the stage
//what would the code look like?
}

View 2 Replies

ActionScript 3.0 :: Changing Width Of Sprite Seems To Change Height Too?

Feb 5, 2009

Here is some code I have.

[code]
_buttonUnderline = new Sprite();
with(_buttonUnderline.graphics) {
[/code].....

When the Tween takes place though it not only changes the width, it changes the height as if it were scaling it up in both directions. Why does this behavior take place? And how can I get it so that only the width changes? I have also tried using scaleX as the property but it does the same thing.

View 1 Replies

ActionScript 3.0 :: Changing Random Colours Of A Sprite In A Loop

Jan 19, 2009

I am trying to create a loop that changes the colours of my dynamic vectors inside my sprite however I am not sure if I putt the following var names in the right place in the end of my statement attached or if i need another variable :[code]

View 5 Replies

Actionscript 3 :: Change Color Of Sprite Without Changing Border?

Jul 1, 2010

I have this [code]...

And It seems to work but this is creating a new rect. Which I do not want.

And I have tried ColorTransform, and that changes everything, even the border, which is not what I wanted. And I am not able to colortransform and then set the border color.

So how can I change the color of a sprite without changing the border color?

View 1 Replies

ActionScript 3.0 :: Changing Width Of Sprite Also Seems To Change It's Height?

Feb 5, 2009

[code]When the Tween takes place though it not only changes the width, it changes the height as if it were scaling it up in both directions. Why does this behavior take place? And how can I get it so that only the width changes? I have also tried using scaleX as the property but it does the same thing.

View 1 Replies

ActionScript 1/2 :: Make A Button Load A Sprite From Library?

Jun 30, 2011

I am trying to create a newspaper that consists of four pages. Each page i have created and are sitting in the library as sprites. Each page  has buttons that need linking so that when pressed it loads the next page or page that i want. This is the part i am confused with =/ how do i make the buttons on each page load the next page (sprite) from the library? Basically i want to no how to make a button load a sprite from the library when clicked. Does anyone no the script for this?

View 5 Replies

Actionscript 3 :: Convert A Library Font Into A Sprite Sheet?

Mar 6, 2012

In Flash I am able to create a font asset and add it to the library:I want to convert this asset into some BitmapData that will contain all of the characters with the correct letter spacing/line height etc.

Is there an inbuilt way of doing this other than manually creating text fields, adding a character, using BitmapData.draw() and then adding the result to a sprite sheet?

If I need to do it manually like above, is there a way to retrieve all of the embedded characters? For example, in the above screenshot I'd expect only a-z, A-Z. Or will I need to note these manually as well?

View 1 Replies

Flash :: Changing A Library Symbol At Runtime?

Apr 18, 2011

I have a problem and I'm not really sure where to start. What I have is an animation of a character in the library. The Character is made up of a few movieclips for the body that move about and one for the face that holds a stock photo.I have a camera section that grabs an image of the users face and now what I need to do is swap the stock face photo for the one taken in the last scene.

View 1 Replies

ActionScript 2.0 :: Changing Bitmap Path On Library

Jan 5, 2007

Is there a way to dynamically change the path of the Bitmap on the Library? Using actionscript?

View 9 Replies

ActionScript 3.0 :: Library Symbol Changing From Blue To Green

May 14, 2010

In Cs4, is there any reason why library symbols would at times change to green from the standard bulueish - purple? FYI, like the lil' gear box looking avatar like things at the left hand side of each library symbol. I have one that changes to green, but I can't seem to understand why? ANYONE?

View 7 Replies

ActionScript 3.0 :: Changing Text Inside Of MC Instances From Library?

Jun 24, 2010

I have several instances of a movieclip which I placed on stage dynamically out of the library. Inside these movieclips I have a textfield. Is there a way that I can change the text of each instance independently?

Code:
var backing1:mcBacking = new mcBacking ;
backing1.x = 94;

[code].....

View 1 Replies

ActionScript 3.0 :: Loading A MovieClip From The Library And Then Changing Text Inside?

Dec 5, 2011

I have a movieClip in the library with the linkage Class name as "LinkClass". I can make it appear on the stage, but there's a dynamic text box inside that is called "linkText" that I can't seem to get working. Here's the code:

myLink = new LinkClass();
myLink.name = "linkButton";
box.boxMC.linksMC.addChild(myLink);

[code]......

View 10 Replies

Make The Buttons On Each Page Load The Next Page (sprite) From The Library?

Jun 29, 2011

My basic aim is to create a newspaper that consists of four pages. Each page i have created and are sitting in the library as sprites. Each page has buttons that need linking so that when pressed it loads the next page or page that i want. This is the part i am confused with =/ how do i make the buttons on each page load the next page (sprite) from the library??

View 2 Replies

ActionScript 3.0 :: Changing Text Of A Text Field Within A Sprite?

Oct 21, 2009

Is it possible to change the text property of a text field that is contained within a sprite? I've been trying but can't come up with the right syntax. Here is what I'm doing:
 
I've created a sprite named "lessonSprite" and added a text field to it in one function. Now, in another function, I'd like to change the text in the field.
 
I've tried to use this:
 
lessonSprite.titleField.text = xmlLsnContent.attribute("title");
 
where "titleField" is the name of the field added to the sprite "lessonSprite" in an earlier function.

View 4 Replies

Actionscript 3 :: Class Extending Sprite - Set The Sprite's Width And Height Properties?

Mar 5, 2010

I created a class, extended the sprite class, and now in the constructor I am trying to set the Sprite's width and height properties which are inherited from the DisplayObject. However, after I set this.width and this.height, and print the values, I get 0 for both.

What the heck is going on? When I view the livedocs I see that DisplayObject has width and height listed as public properties. I have been able to instantiate a Sprite directly, and set the width and height after it's been instantiated, so I don't get it.

package {
import flash.display.*;
public class ScrollBar extends Sprite {[code].....

View 1 Replies

Flash: `sprite.visible = False` Doesn't Hide Sprite Immediately?

Apr 4, 2011

I've got a sprite which I want to temporarily hide... But changing the .visible property doesn't do what I expect. The code looks roughly like this:

[Code]...

View 1 Replies

IDE :: Adding A Single Sprite On Main Moviclip Sprite Remains Invisible

Mar 2, 2009

I created a new AS3 document (550px by 400px) and added the following code to the first frame.

However, when I run this, I see nothing painted on the screen at all, the screen remains completely white.[code]...

View 3 Replies

Flash :: Rotating Sprite Moves The Sprite From It's Original Location

Jul 6, 2011

I'm doing a simple rotation on a sprite but there's a weird behavior where the sprite does not rotate around it's top left. I think I'm rotating along the top left of the test class instead of the sprite child. I would like to rotate the rectangle around it's top left corner (kinda like a clock hand). The code is pretty short so I'll let the code + pictures explain my problem:

package
{
import flash.display.Sprite;

[Code]....

I've read a lot of stuff about rotating around a fixed point, I've tried doing it with movieclips instead of sprites, I even copy pasted a tutorial on rotation and nothing works.

View 3 Replies







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