ActionScript 3.0 :: Calling Graphics In Custom Object?

Dec 14, 2011

I am trying to create a custom object which will display particular graphics at a particular time (when the movie tells the object to show something). Well I made my object (the way I thought it would work) and I encountered a problem when I called graphics functions from the main movie.

I made a very stripped down version of the same object to test and see what was going wrong. Apparently, I can call "Draw()" directly from inside the constructor and it will use the draw methods, but I cannot call it from the movie (like in the script below) and I can't call it from another function in the object if that function is not called during the constructor.

The question is... am I doing this right? The simple version of my end goal would be to create this object and have a function that I can call in the object something like "DrawImage(imagePath:String)" and it will use the graphics to draw the image.

In the movie:
----------------------------------------------

ActionScript Code:
import com.experimental.DynamicSprite;
import flash.display.Sprite;

[Code].....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Timer With Custom Graphics (MovieClips)

Dec 16, 2010

I'm trying to set up a timer with custom graphics (MovieClips) and I've basically got it to work, but it's acting really strange! I have two MC's on stage, named "secs_0" & "secs_1". They're both instances of another MC ("numbers"), which contain 10 frames with one digit on every frame (0 - 9). The weird thing is that the counter starts from 87! When the actual value of maxTime is 97... Also, when it reaches 80, 70 etc... it pauses and starts again at 78, 68... Here's the code

[Code]...

View 4 Replies

ActionScript 3.0 :: Graphics.lineTo With Custom Style?

Sep 17, 2009

using pencil tool inside flash i can create stippled line style, well, im using graphics.lineTo(mouseX, mouseY) to create a drawing API but i need use some in this line a style like stippled stroke, or if is possible use stroke ( and how ) to make the same line using stippled style?

How to custom this line?

View 5 Replies

Actionscript 3 :: Custom Object To ByteArray Then To Custom Object?

Sep 18, 2010

Having problem reading bytearray of custom objects.

public class CustomObject extends Object {
public function CustomObject() {
public var _x:Number = 100

[Code]....

View 3 Replies

ActionScript 2.0 :: Calling Tween From A Custom Class?

Jun 11, 2009

i am making a simple slideshow in AS2 (Flash CS3). I got all the core logic working fine in a FLA frame action - now trying to externalize it into a class. The first snag I hit was in trying to setTimeout -- when I passed a class method as the setTimeout function, it no longer could talk to the class variables/methods. I fixed this by passing along an instance of the class to the class method called by setTimeout something like this:

setTimeout(myMethod,delay,classInstance);

Now I've got a similar problem with my Tween.onMotionFinished() handler -- i want it to call another method in my class but it doesn't know what the class is or how to access it.How should this be accomplished? I've tried a similar trick in which I try to stash a class instance inside the tween (through bracket syntax eg. myTween["classInstance"] = this; but this doesn't seem to work.

Is this a case where I basicallyneed to create an event listener in my class & then just send an event out when the tween finishes? Or is there a simpler way to let the tween know about the class (without relying on instance names of the class itself)?I'm still new to OOP so not completely got my head around what can/can't access my class methods/variables especially when I'm creating objects like Tweens inside my class.

here's my current SlideShow.as class:

Code:

/*
imports
*/
import mx.transitions.Tween;
import mx.transitions.easing.*;

[code]...

and then I just create a slideshow from an existing framesequence MC (who has stop() on frame 1) in the FLA thusly:

Code:

import com.pixelfarminteractive.slides.SlideShow;
//SlideShow(slideMC:MovieClip,easeTimeSec:Number,holdTimeSec:Number,numSlides:Number)
var ss = new SlideShow(slideshow_mc,2,2,4);
ss.start();

View 17 Replies

Javascript :: Calling A Custom FLASH Method From IE7 & IE8

Oct 13, 2010

I am trying to call a custom method of an embedded flash like so:

var flash =
navigation_get_flash_movie_object('main');
if (flash) {
flash.continentOut(id); }

Which works great in Chrome ans Safari, but fails utterly in IE7 & IE8. The browsers throws an error that the object doesn't have such a method.

I am using the example from [URL], and now that I've tested it, it also fails at it's testing page as well [URL]

invoke custom functions in a Flash object from Javascript?

View 1 Replies

ActionScript 3.0 :: Calling Text From Custom Class?

Apr 12, 2010

I am trying to figure out how to call a title to come on screen when the titles are defined in an .as file that is not the document class. The titles would be defined in one .as file like the one I have posted below. I am trying to economize on the number of things that I define by not repeating code. So I wrote out the following quazy code to give you an idea of what I have done to create the titles. How I would call a title in the document class from this custom Titles class.

Code:
package asFiles.stageElements {
//import statements
public class Titles extends Sprite {
//variables defined
public function Titles {
[Code] .....

So I guess the question is what statement would I use to call one one of the titles above to be displayed?

View 2 Replies

Flex :: Set Text On A Graphics Object?

Oct 19, 2011

Is there anyway I can effectively call the equiv. of setText on a Flex Graphics object ?Specifically I'm using a custom cell renderer to display data in a datagrid. The renderer uses the Graphics object to set the background colour of only a portion of the cell (say the left half) based upon the underlying data. I would like to be able to have text over only that portion of the cell which has the background colour (eg centred within the left half). I know all the widths (of both the cell itself and the graphics object) but I don't know how I can set text (centred) over the graphics object.

View 5 Replies

Flex :: Set Text On Graphics Object?

Nov 3, 2009

Is there anyway I can effectively call the equiv. of setText on a Flex Graphics object ?

Specifically I'm using a custom cell renderer to display data in a datagrid. The renderer uses the Graphics object to set the background colour of only a portion of the cell (say the left half) based upon the underlying data. I would like to be able to have text over only that portion of the cell which has the background colour (eg centred within the left half).

I know all the widths (of both the cell itself and the graphics object) but I don't know how I can set text (centred) over the graphics object.

View 4 Replies

ActionScript 3.0 :: Know What Has Been Drawn In A 'graphics' Object

Jul 17, 2009

Lets say I have a customMovieClip. I sometimes draw an ellipse with customMovieClip.graphics and sometimes a rectangle. Now I want to know what was the shape ( ellipse/rect) that was created using a particular graphics object. Doing this would enable me to pinpoint what exactly to do with that customMovieClip() instance.

View 3 Replies

ActionScript 2.0 :: Calling Functions Inside Custom Class?

Aug 17, 2007

what I want to do is let a lister triggered function create a new timer, but somehow it doesn�t work.

Code:

class classesUI.GamePage extends MovieClip
{
private var timeKeeper:TimerExtended;//Special class
private var roundTimes:Number;

[code]...

View 1 Replies

ActionScript 3.0 :: Get The Pixel Color Of A Graphics Object?

Jul 19, 2009

for example,graphics is an object from a movieclip ojbect.I want to get the pixel color at the x,y location in the movieclip.How to do?

View 5 Replies

ActionScript 3.0 :: Modify A DrawCircle Graphics Object?

Sep 21, 2009

I have a Sprite in which I have drawn a circle with a fill.  Later on, I wish to modify the color of this circle.  I have retrieved the Graphics object from the Sprite using getChildAt(), and have tried:
 
getChildAt(i).graphics.beginFill(0x550000);
 
however this does not work.   I've RTFM'd but can't figure out exactly how to deal with the Graphics object.

View 4 Replies

Actionscript :: Clear Just A Portion Of A Graphics Object?

May 10, 2011

I am making a Flash CS5 application in which the user draws transparent overlays on a Sprite placed on top of an image. The user needs to be able to erase his input as in MS Paint, Adobe Photoshop, or GIMP. Because the Sprite is on top of an image, there is no safe clear color I can think of to draw over the section that the user has just rubbed his eraser over

View 1 Replies

ActionScript 3.0 :: Clear A Certain Area In Graphics Object

Jul 3, 2009

I'm implementing a simple painting programm. Therefor I need something like a Graphics.clear() function, not for the whole Grahpics object, but for a small area only.I don't want to paint in white color instead, I just want to really clear the previously drawn lines and stuff.

View 2 Replies

ActionScript 3.0 :: Knowing What Has Been Drawn In Graphics Object

Jul 17, 2009

Lets say I have a customMovieClip. I sometimes draw an ellipse with customMovieClip.graphics and sometimes a rectangle. Now I want to know what was the shape ( ellipse/rect) that was created using a particular graphics object. Doing this would enable me to pinpoint what exactly to do with that customMovieClip() instance.

View 3 Replies

Flash :: Calling A Method In Custom XML Class Returns Null?

Sep 7, 2011

I am trying to call a method that has some xml functionality and It keeps coming up null.What I am trying to do is; I have a page that has four dynamic text fields that get their content from an xml file. I would like to create a method that will output the contents to display in the dynamic field. Maybe my approach is WAY off here, but my supervisor wants all xml related tasks contained in a xml.as fileMain.as

package classes
{
import flash.display.*;

[code]....

View 1 Replies

ActionScript 3.0 :: Calling Class Object Into Another Object?

Jan 19, 2010

Steps - Make 2 MovieClips. One MC will be a 500x400 picture. The other MC, will be a simple circle called "Ball". Make that Ball a Class by editing the properties, and assigning it the Class name "Ball" as well.1) Picture is static, so we have the picture MC sitting on Frame 1.2) Within the Document Class file, instantiate the new "Ball" class with name "ball" 2a) I want the "Ball" to be added to the picture class, so that every time I call it, the Ball is inside the picture. If you were to trace it - trace (picture.ball);Anyone know how to go about doing this? The code for simply instantiating the "Ball" class = Code:var ball = new Ball(); addChild(ball);

View 1 Replies

ActionScript 3.0 :: Graphics Item A Null Object In Other Functions?

Mar 26, 2009

OK, so I have code making a new graphics item and calling it sliderBar:

Code:
var sliderBar:Shape = new Shape();
sliderBar.graphics.lineStyle(2,0xFFFFFF,1,true);

[code].....

View 4 Replies

Actionscript 3 :: Draw Shadow Without Filter On Graphics Object?

Sep 27, 2010

I have a complex graphics data on a sprite or a shape (no matter which is exactly). But I want to draw shadow (inner too) for one Rect ( [10, 10, 240, 25] for example) or another path.

[Code]...

View 1 Replies

Flash - Draw A Bitmap In Graphics-Object At Any Position?

Mar 30, 2011

Is it possible to draw a Bitmap to a Graphics-Object like

this.graphics.beginBitmapFill(bitmapData, matrix, false);
this.graphics.drawRect(0, 0, w, h);
this.graphics.endFill();

with an offset?

A simple moveTo(x, y) call before beginBitmapFill does not work :/ Neither does changing the x and y value of drawRect... (That just seems to have the same effect as an translation with the matrix...) Additionally I don't want do draw that thing in a separate Graphics-Object and add that one into the other...

View 2 Replies

Flex :: Give A Depth To An Object Created From Graphics?

Apr 18, 2011

I am drawing some lines in my program using

graphics.lineTo(xx, yy);

The program has a background image over which these lines are drawn.The problem which I am facing is that the image overshadows the lines and the lines are not visible to the user.Since these lines do not have an id, I am not sure as to how I can assign a depth to them?

View 2 Replies

ActionScript 3.0 :: Determine Current Pen Position In Graphics Object?

Jan 3, 2010

Is there a way to determine the current position of the pen in a graphics display object. Something similar to what is discussed in this thread but for AS3?

View 4 Replies

ActionScript 3.0 :: FlvPlayback Skin Custom Button Calling External Function

Apr 1, 2011

I have a custom movie clip in the flvplayback skin and I am looking for a way to call an external js function.[code]Unfortunately, the External Function is not being called at all.

View 10 Replies

Flex :: Where In Framework Graphics Object Passed Around To Achieve Drawing

Oct 23, 2009

I'm trying to understand how the Flex framework draws objects (Button, Label, Image, etc.). The Button class seems to draw itself by addChild()ing its ProgrammaticSkin. However, where in the framework is the Graphics object being passed around in the hierarchy to achieve the drawing. I want to get to the level of 2D API.

View 1 Replies

Actionscript 3 :: Flash : Read Data From Shape/graphics Object?

Dec 2, 2009

I am wondering if it is possible to get the data that is stored in a shape/graphics object in flash using actionscript 3?

In my project I would like to be able to draw a shape and then read all the points in that shape into my script. The reason for that is that I need go generate lines from those points that I later can use to check if my characters velocity intersects with any of them.

View 3 Replies

Actionscript 3 :: Possible To Export A MovieClip Or Graphics Object To A Vectorial Format?

Oct 22, 2010

I want to export some vectorial drawings to a vectorial format (eps, svg,...) from a Flash application. Everything is vectorial in my application so it should be possible to do it, but I can't find a solution

View 1 Replies

Flex :: Graphics - Filling Color In An Object Built Using Primitives

Apr 22, 2011

I have a bounded object, created using primitives lines in Action Script- either an oval or a triangle. Is there any way I can fill the contents in a specific color

Just to clarify on this- the shape could be in two ways

a) drawing a isoceles triangle based on a variable apex angle

b) two curved lines to form a "lens"

I am not sure if I can use the fill function, as I am not drawing a inherently bounded shape- the closed nature is based on my calculations

[Code]....

View 3 Replies

ActionScript 3.0 :: Flash Clearing Graphics Object Of Sprite When Dispose Off

Jan 29, 2012

When I'm disposing a sprite which has drawings on its graphics object, Do I need to use "graphics.clear()" or is "mySprite = null" is enough?

View 3 Replies

ActionScript 3.0 :: Listening For Custom Event Dispatched From Parent Object In Child Object?

May 25, 2010

I want to listen for a custom event dispatched from the document class in a custom subclass. For example, let's say in the document class I have:

ActionScript Code:[code]....

So that the subclass will trace 'Event from document class received' when the 'customEvent' event from the document class is listened by the eventlistener. However, the output is only 'customEvent dispatched', meaning it wasn't heard in the subclass.

View 7 Replies







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