ActionScript 3.0 :: Using The Shape Class To Create A Star?
Feb 7, 2010Does anyone have an example of using code and the shape class to create a star shape?
View 1 RepliesDoes anyone have an example of using code and the shape class to create a star shape?
View 1 Replieswell in my fla i have a movieclip exported with class name Star and in my Star.as file i have this code:
package { public class Star {
public function Star() {
this.visible = false;
}
}
i tried putting movieclip on and off stage but didnt work all i want to do is control my class Star in my fla. Im very new to OOP and trying to get the gist of how to control objects like the way you could by instances like i used to :/
I want to use Image Reflection in trapezoid shape. That why i ask how to create trapezoid shape with the class of matrix
View 1 RepliesI'm using this code for tweening:
ActionScript Code:
var myTween:Tween = new Tween(star, "alpha", Strong.easeOut, 0, 0.9, 3, true);
And I also have some extra code that spawns stars all over the place.If you view my swf, http:[url]...., you can notice that the stars appear to 'flash' first before settling down.I'm simply wondering if this is some problem of the Tween class or if I set something wrong. Something I found odd was when I removed my code that generated a random colour for my star,
ActionScript Code:
//var myColor:ColorTransform = this.transform.colorTransform;
//myColor.color = Math.random()*0xFFFFFF;
//star.transform.colorTransform = myColor;
, the flash doesn't happen. Is it a visual effect that causes it to look like it's flashing or is it really?
I'm new to Flash AS3. I started making a game and I am a bit confused. Let's assume that I want to create a game that has multiple levels/modes, how can I do this in an object orientated way?
When i create games in other languages e.g. XNA C#, i create a separate class then create an object of that class within the main class and run the game based on a simple statement.
[Code]...
I've been playing around with custom classes. My objective was to create a custom class (Testing) that would create a box when an instance of the class is created. I've tried three different approaches, however only (3) seems to be showing up. I'm just curious why (1) or (2) doesn't work?
Also is there a better approach than (3)? Since at the moment it's been created on _root. I hope the box can only be accessible through the instance. Since I'd like to incorporate the whole idea of public, private, encapsulation, etc.
[Code]...
How can I create such a shape using the Drawing API? where red means filled and white means not filled
View 1 RepliesI have two bitmap graphics (bmp1, bmp2) already created with the BitmapData class using the contents of an object (label1):
var myBitmapData1:BitmapData = new BitmapData(150, 150);
myBitmapData1.draw(label1, matrix, null, null, null, true);
var bmp1:Bitmap = new Bitmap(myBitmapData1);
[code].....
I want to pass extra arguments to Shape class.
I think this can be done if I override a native Shape class.
how can I override ? Or How can I add a property to a shape?
My application has a lot of dynamically loaded shapes... Now i am working on an interface to change the color properties of each Sprite. The first idea was a simple colorTransform. But afaik this only allows for transforming the existing colors. I also want to be able to define a NEW fill, i.e. GradientType.LINEAR / RADIAL.
SOLUTION 1: There may be an undocumented method to retrieve a graphics current points. With that i could loop through this Array with lineTo and redraw the current shape with the new solid / gradient fill.
SOLUTION 2: Create a newSprite with the chosen GradientType, size it by currentSprite.getBounds(); and then use newSprite.mask = currentSprite; to fake my desired fill... However, i am afraid of the impact this creates on the application as there may be more than 200 of these Shapes displayed on stage... overlapping each other.
I have a diamond shape movieClip and I need add a text Field in the same shape format.Now how to create a diamond shape text field?
View 1 RepliesWell, there's a web page that shows this effect, but I can't post links here (<50 post count) so I'll just have to describe it in words.
The flash content is a rectangle in the center, which is centered depending on the browser size. This would probably be the size of the stage.
What I'm interested in is the dynamic background that fills the screen with a shape. What seems to be happening is this[code]...
how I can create a movie that draws a shape on screen.
I understand how to draw a line, etc but can not work out how to see the shape build. I do not want something likes Kirupas' drawing demo as I do not want the viewer to create the shape.
For example I want to see the lines being drawn and control the speed, rather than the shape simply appearing in the movie.
I realise I need to change the lineTo value
An example is the way the TV is drawn in [URL] although I am not sure if this uses actionscript or is something else.
I am trying to create a circle instance of FirstCircle class (by Milan Toth):
ActionScript Code:
package
{
import flash.display.Sprite;
[Code].....
I supposed the constructor would do all the work then. When testing the movie I get no error but no circle was displayed, trace statement put in the class constructor displayed the message ok. When I put the class code directly to the ACTION FRAME, it works fine.
what should I do to get the circle visible in the fla using the FirstCircle class?
Im checkin out actionscript for basically first time kind of. Im now looking into creating shapes with actionscript at the same time learning the way actionscript handles oop.
So, here is my problem. Its easy to make a shape, but from within a method of a class, the shape will not appear on the stage. I try the same code snippet in my fla file, and it works fine. Here is the code im using:
The package file:
Code:
package com.adobe.shapelib {
import flash.display.DisplayObject;
import flash.display.Graphics;
[Code]....
why the shape is not appearing? As mentioned if i take the contents of the function named "circle" into my fla file directly, it appears as normal...
This is my first meeting with the Shapes; which don't seem cooperating, at all. Following is the Class code:
Code:
package
{
[code]......
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 RepliesI drew a line (stepVoltage) in a fla using the graphics class. Once drawn, I want to move it to the right in an update function, but am having trouble. I tride just moving the line with statements like stepVoltage.x = newX; stepVoltage.y = newY; but this didnt work. Then I tried to delete the previous line and draw a new one with a clear () function (see below) but this blocked the next drawn line from showing up.
The code:
var stepVoltage:Shape = new Shape ();
stepVoltage.graphics.lineStyle(2,0x000000);
addChild (stepVoltage);
[Code]....
I'm trying to create and expand a simple empty box (hairline perhaps) with an Action script to create the same effect as a shape tween. Why not shape tween?! Well I've tried that and the shape tween messes up the rendering. see picture....
View 14 RepliesSo I'm playing with a project where I want my class to be able to use the functionality of the Graphics class without needing to extend Sprite/Shape. My goal aside, I guess I'm confused as to how it works at all? It's methods don't seem to return anything, and since it's added as a child property of the Sprite/Shape classes , I can't seem to figure out what it's actually doing? It's also one of those classes that can't be instantiated.
At this point, I'm just plain curious. EDIT: I should provide more clear distinction of what I'm looking for as answer. I have read the documentation, but the documentation doesn't account for what AS3 is actually doing. I'm looking for educated guesses about the programatic relationship between Graphics and the the classes that use it.
I downloaded an Mc Tween Class from [URl] so I can use the ColorTransformTo method. However, the method only works when my movieclip is an image; and I need the method to work when the movie clip is a shape...
View 1 Repliesi hope this is not a stupid question but does anybody knows how to make a shiny star?i want to add it on a picture.
View 1 RepliesActionScript Code:
package {
import flash.display.MovieClip;
public class Base extends MovieClip {
public var baseHP:int = 50;
var newRect:Shape = new Shape();
1046: Type was not found or was not a compile-time constant: Shape. 1180: Call to a possibly undefined method Shape. What does it mean by "undefined method"? I am somewhat of a newby, so sorry if there are any stupid errors
Whenever I add shape hints to a shape tween the shape disappears in the between frames. I am using CS5 on Vista. I using files from [URL]to practice.
View 2 Repliesneed to draw the shape of a existing movieclip which is irregular shape.
View 2 Repliesneed to draw the shape of a existing movieclip which is irregular shape.
View 1 RepliesAnyway, I'm looking to create a star object that flickers or blinks at random intervals. The object will also be part of a menu system and may need to perform other functions, so, I may need to roll my own class eventually.
Here is how I initally went about it:
Code: Select allfunction myRandom() {
var r:Number = (Math.random());
[code]....
I only want it to work as a form so i can have a php file process it.I don't need the actionscript just an idea of how I should start.
View 4 RepliesId like to know if there is a way to do a shape hitTest.Not as the normal hitTest would do, but shape colliding another shape, not the rectangleof a movieclip.It can be in a movieclip.
View 23 RepliesI have a textbox where there should be a 1 to 5 star classification for a movie, so I used the star symbol (character code 0xAB) from the Wingdings Symbol Font. But instead of the stars, What I get is double angular quotes in Arial, the corresponding character in a normal text font: «
In fact, every Wingding character above 0x80 (included) is displayed in Arial instead of Wingdings. This also seems to happen with all Symbol fonts.
I've also made Wingdings into a font symbol but the problem still happens. It also happens in static text boxes.
To reproduce the error just make a text box and set the font to Wingdings. Now type something and it shows in Wingdings but press ALT+0171 (or copy the star from the Character Map app) and instead of a star, you get double angular quotes.