ActionScript 3.0 :: Interesting Way Of Defining DrawRect
Sep 10, 2009I'm currently working my way through Joey Lott and Danny Patterson's Actionscript 3 with Design Patterns book and ran into this code:[code]
View 3 RepliesI'm currently working my way through Joey Lott and Danny Patterson's Actionscript 3 with Design Patterns book and ran into this code:[code]
View 3 RepliesNormally when we draw a rectangle with linewidth 1 no problem.But if we apply a linewidth more than 10, the corners of rectangle seems rounded shape.[code]
View 2 RepliesI normally use flash, so this normally wouldn't be an issue, but now I'm using Flex (I'm not a different computer). I wrote a very simple program to draw a rectangle. Here is it:
[Code]....
Using Flash CS3 If I draw two overlapping rectangles with two different fill colors, I get the expected results.If I draw two overlapping rectangles with the same fill color, the overlapping region appears white, almost as if there were an exclusion blend applied.
View 9 RepliesI've created an entire website from one .swf. No dynamic loading of other .swfs, or external content etc. Simply a few different buttons that navigate to different frame-labeled areas of the .swf via gotoAndPlay, etc. There are 8 different "areas" of the timeline to go to, each with it's own set of movie clips for that area.
As far as I know, the website works great on all computers and browsers with current Flash players. But I got a call from one of the owners of the business I created the site for and he's having an interesting problem: The preloader completes and takes him to the first area. He can see areas 1-4 just perfect. But when he click to go to area 5, less than half of the movie clips load in what seems to be a random order and then the rest of the .swf (beyond that point in the timeline) can't be accessed at all.
This could be common, but as far as I know, I've never heard of it. He's had someone at his site who is apparently "fluent in computer" look over his internet settings and cannot find any issues.
Anyone ever heard of this or know what I should suggest he try besides updating his browser and Flash Player?.
Is there a neat minimal way of doing this? (this produces an error):
var freeSpace = shape.freeSpace() // returns Rectangle
var s:Sprite = new Sprite();
s.graphics.drawRect(freeSpace);
Just looking for a more cleaner way other than something like .drawRect(freeSpace.x, freeSpace.y, freeSpace.w, freeSpace.h) I know you can do it with bitmapData.fillRect(rectangle), but need sprites in this case.
I'm trying to draw a shape but am having a weird issue. I'm not getting any errors, but no shape will show up. I get a blank white canvas when I run the .swf with the following class:
[Code]...
I was at a website (link from my son's baseball group: Coach Wooden and saw an effect that I couldn't figure out how they did it. It's the "gleam" on the text that runs about every 5 or so seconds.You'll have to enter the site to see it.Just right off hand, it looks like the text is a mask, and it has a tween or .x motion applied.
View 2 RepliesWell I'm creating a small image gallery of thumbnails and am looking for interesting effects when the big pic loads. I'm sick of just fading in images with the alpha setting and need some inspiration. I've done a google search but it revealed nothing of any use.
Do you know of any tutorials for this or fla downloads?
how to make a interesting flash based game?
View 1 RepliesLast week I had posted about getting a bit of clarification on dynamic tabs, as seen in this thread: [URL] The next step has my head spinning a bit. Here's the setup: This is a slideshow viewer, ala PowerPoint. Images are pulled in from an external directory via an array. Dynamic tabs are also generated in an array. Right now the demo has 10 images in the first array and 6 tabs in the second array:
[Code]...
now, some of the images will be part of a range - as in maybe the first three would fall under the "Safety" tab, next two under "Efficacy", etc....so when a viewer clicks on a tab the player loads up the first photo in that sequence. So: User clicks tab "X", this compares "X" with the range of images associated to "X" and loads the first in the sequence. Now, to add in more fun, there's a next and back button. So now if someone hits the next button then they should view sequentially the next image in the "X" image array (or sub-array). and the reverse for the back button. so my first thought is that I'd need to have the AS compare Safety with the imageList Array - something like
[Code]...
I was recently given the task of creating the webpage for my school's physics department. I want to recreate a textbook where you would actually have to flip the page to get to the next section. While searching the net, I found exactly what I was looking for.
link
How on earth can I recreate that effect? I know it has somethning to do with rotations and dragging a mask with the mouse but how?
This is a test program to measure the time it takes Flash to draw a triangle 10,000 times.
The app (code below) calls runTimeTest() every N seconds which draws the triangle 10,000 times.
Now for the "interesting" part: each call takes increasingly more processor until after about the 6th or 7th call it goes to "infinity" (see screen shot of TaskManager)
[Code]...
I am trying to get a dynamic text box embedded in a button to populate on (XML) load but am having trouble with the path. The text boxes not embedded populate just fine. I have attached my FLA and my XML is below.
//XML
<?xml version="1.0" encoding="utf-8"?>
<topics>
<content>
[code]....
I posted a problem recently and I think I was asking too much too soon, I apoligise for that one. I want to try again with my problem. Basically I am making an interactive circuit builder in flash mx for 8-10 year olds (does anyone remember crocodile clips?).
[Code]...
I am trying to define a CSS style dynamically. how to get around hard-coding the values this way:
code: var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.setStyle("mainBody", {color:'0xff0000, fontSize:12});
I tried something like this, but it isn't working:
code: var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.setStyle("mainBody", {color:colorVariableFromParentMovie, fontSize:sizeVariableFromParentMovie});
How do I define the window size of the opening window if I have something like this:
function ClickHandler(event:MouseEvent):void{ var req:URLRequest = new URLRequest("something.html"); navigateToURL(req, "_blank");}
I am using a movie clip with graphics as a cursor.
However, it appears that the actual 'hit' area of the movie clip is related to specifically the normal arrow cursor.
I would like to be able to define an area of the graphic, in this case it's a hand holding a billy club so I'd like just the tip of the billy club the 'hit area.'
Is this possible via AS2.0?
I have an array, created as:
ActionScript Code:
myArray:Array = new Array(10)
pretty much just saying there is 10 elements in it. I define each function as "land", for example. Then in the same function I redefine a random element as "water".
(It is a bit more complex, this is simplified!)
Upon executing this I get the error:
ActionScript Code:
TypeError: Error #1010: A term is undefined and has no properties.
if I put the second bit in a new function (the random water part), there is no problems and it executes perfectly. Obviously I cant define an element twice in the same function.
this is my first attempt at defining a function all by myself and surprise it don't work! I'm sure you can see from below what I'm trying to create.
[Code]...
Basically dependent on the hour the text displays a relevent welcome message. Once I cracked this I was going to use the same code to alter an animaton of a scene to reflect the time of day.
Here's what I've got:
var cColor1:Color = new Color(mcBut1.mcFill);
var cColor2:Color = new Color(mcBut2.mcFill);
var cColor3:Color = new Color(mcBut3.mcFill);
var cColor4:Color = new Color(mcBut4.mcFill);
var cColor5:Color = new Color(mcBut5.mcFill);
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
Something like:
for (var i:Number = 1; i < 6, i++) {
var cColor+i = new Color(eval("mcBut"+i).mcFill);
}
I have drawn a rectangle area in which I want to drag a copy of a MC instance from outside the rectangle.
1. I want to be able to define the rectangle as a boundary so that I can drag and drop a copy of the instance from outside the rectangle to inside the rectangle. If the MC instance is dropped outside the rectangle then the MC instance snaps back to it's original position.
2. Once the MC instance has been dragged and dropped inside the rectangle it can be dragged and moved around BUT only inside the rectangle and not outside it.
using the MovieClipLoader function to load in several images into various actionscript defined movieclips. These movie clips, with images loaded into them, are going to have onRelease functions associated with them which will load in a larger version of the image already loaded. As you can picture, there are a series of thumbnails, and each thumbnail needs to be clickable and load a larger version of itself into an empty clip. However, I can't seem to define variables inside of the MovieClipLoader object as it's not technically a movie clip?
How might I know which larger file to load when one of the thumbnails is clicked? All the files are named all sorts of things, aren't in any particular order (user defined from a drag-n-drog UI)... I thought I was on the right track, until I realized I couldn't define variables within the empty clip holding the thumbnails..
this is my first attempt at defining a function all by myself and surprise it don't work!
I'm sure you can see from below what I'm trying to create.
stop();
daytime = function () {
myDate = new Date();
var h = myDate.getHours();
[Code]....
Basically dependent on the hour the text displays a relevent welcome message. Once I cracked this I was going to use the same code to alter an animaton of a scene to reflect the time of day.
I'm building a script that adds a textfield to a movieclip. I need to add an onkillfocus event to that textfield that will make it call a certain function, which is located in the movieclip where the textfield will reside. The trouble is that I'm creating the textbox in a script in a completely different movieclip, and I'm having trouble getting the event to find the function.
_root["item"+x]["labelText"+y].onKillFocus = function() { labelEmpty(this._name) };
The absolute path to this function is _root["item"+x].labelEmpty How do I get this event to call the labelEmpty function?
Here's what I've got:
[Code]...
What I'd like to do is write a loop to handle all that code in less code. So, how do I define variables using variables?
[Code]...
Is it possible to define a variable inside of function where the actual variable name will change based on what parameters the function is called with? Take a look at this code:
Code:
//define the function
function attachVid(nc, ns, curVid, vidFile) {
[Code].....
I am trying to make the net Connection and net Stream object unique each time the function is called because I am trying to play like 5 flv's on stage simultaneously. As far as I know, each video stream needs a unique net Connection and a unique net Stream object. But it doesn't seem to be working.
I am trying to figure out how to reference something thatappears later in the timeline with Actionscript on the firstkeyframe without receiving run time errors such as "undefined", or"null references". Trying to define the objects using references(ie. var myMC:MovieClip) doesn't seem to cut it. Short of placingitems on the first keyframe and then pushing them off the stage outof view, I have yet to find an elegant solution for this
View 1 RepliesIt's not clear to me, where I have to define Classes and Constructor methods. In AS2 it was possible, to define a class "light" by defining a constructor method. In AS3, I read, a class can only be defined in an external AS-file. Is it still possible to use the constructor method inside the Flash-File or do I have to source out all my constructor methods and implement them into real classes into an external AS-File?
View 4 RepliesI'm having a strange problem setting variables in movie clips from another (parent timeline). I run the following code from the parent movie clip to target child movie clips it contains.
setVars = function (clip, value) {
clip.val1 = value;
clip.val2 = 0;
[Code].....
I am trying to set variables in a movie clip targetted by the 'clip' argument in the setVars function but they are being traced as undefined. However, setting the function works fine. I have also tried manually defining the variables in the movie clip and am still unable to change them externally from the setVars Function.