ActionScript 2.0 :: Shadow Casting Angle Bug?
Jan 10, 2011
Okay so quite an ambiguous title but what I'm trying to do is cast a shadow off shapes from a light source. Simple enough and I have it working but I just can't work out how to fix the problem of when the light source is at a certain angle to the shape I'm casting a shadow from.I know it's the whole 180 to -180 thing, but I just can't think of a work around.I've attached the swf and fla so you can see for yourself.Basically the code works by chucking points of the shape in an array and then arranging the array by the angle of each point from the light source. No big deal. From there it just takes the first and last point in the array and draws a shadow from there. Sketchy for the time being I know, but I just don't understand why it's doing what it is.
View 0 Replies
Similar Posts:
Sep 20, 2010
I want to make a game which uses a light effect similar to left4kdead (link). I just can't seem to be able to find how this effect is called. It will be strictly 2d top-down view.
View 13 Replies
Sep 9, 2011
How to remove the cursor shadow (black shadow), when we use onChanged function, am validating the value from what I enter from keyboard
View 1 Replies
Feb 9, 2005
Ive made this rotation with AS. But Id like to make the bar to move from angle A to angle B smoothly.
How can I do this?
View 2 Replies
Feb 20, 2009
i have been searching the internet for a bit, and maybe i don't know what to look for but i know filters have stage scaling enable, not sure that is what i am dealing with but for some reason i can not scale a movieclip that contains a movieclip with a drop shadow filter without the drop shadow acting like the light source has changed, have tried copying the bitmapdata....anyone know how to "freeze" the drop shadow.
[Code]...
View 7 Replies
Jan 2, 2012
Is it possible to develop a Flex Mobile App to record the complete actions we do on the mobile?? Like recording (screencasting) all the activities I do on the Mobile Phone. I want to do this using Flash Builder 4.5.
View 2 Replies
Mar 12, 2012
I have a base class called Room and a subclass called Attic, and another called Basement.
I have a controller class that has an attribute called CurrentLocation which is type Room. The idea is I want to be able to put Attic or Basement in that property and get it back, then cast that to whatever type it is.
So if on the controller the content is of type Attic, I'm trying to figure out how to explicitly cast it. I thought I knew but its not working... Here's what I thought it would be, borrowing from Java:
var myAttic:Attic = (Attic) Controller.CurrentLocation;
This gives me a syntax error:
1086: Syntax error: expecting semicolon before instance.
So how do you cast implicitly? Or can you? I could swear I've done this before as as3.
View 1 Replies
Feb 5, 2009
haven't wrote here for a while!This is what I'm trying to do:
var level:Number = 1;
var goat:* = "thisIsLevel" + (level + 1);
var camel:Function = goat;
[code].....
View 3 Replies
Jan 7, 2010
I am calling on different types classes from within a loop. The objects can be of different types so therefore I am using the getDefinitionByName method. here is a piece of my code:
for(var y = 0; y < mapH; y++)
{
brickHolder[y] = new Array();
[Code]....
But I got an error when I tried to call on methods. The interface is blank; doesn't have any methods in it. I am not sure if that makes a difference. But the parent class inherits it and the subclasses inherit the parent class. Can I instead use the parent class?
var brick:ParentBrick2 = ParentBrick2(new classRef());
In a nutshell, what can I do to loosely cast these objects so I am able to use any subclass methods that get called?
View 4 Replies
Aug 16, 2011
I made a class in AS3 for representing complex numbers. It does not inherit anything. How can I enable casting from e.g. Numbers? I.e. I want this:
5 as Complex
to be the same as this:
new Complex(5);
is there a magic cast() function I can put in my class?
View 1 Replies
Aug 18, 2011
Any class common between flash swf file, loaded in swfloader turns our to throw error ypeError: Error #1034: Type Coercion failed: cannot convert edia::PlayerContentView@12babac1 to media.PlayerContentView.My main swf has same class, since its been used by appplication all over, but when swfloader creates object of same name class, it adds 12babac1 to class name. and doesn't work for simple access of array values
public function get Current():media.PlayerContentView
{
return contentItems[VZPlay.CurrentIndex] as PlayerContentView;
[code].....
View 1 Replies
Nov 4, 2010
What is exactly difference between casting with np: DisplayObject(myObj) or
myObj as DisplayObject
View 9 Replies
May 1, 2007
Let's say I have 3 items in the same package:Shouter interface - requires implementers to implement the shout() functionShell class - implements Shouter...this Shell.swf is to be loaded remotely from:ShellLoader class - loads Shell from a remote server, casts it as a Shouter and invokes its shout() function...uses allowDomain in order to cross-domain script.Now let's say ShellLoader.swf lives on and Shell.swf lives on ....I've got a cross-domain policy on Using LoaderContext's ApplicationDomain and SecurityDomain, I'm able to load and cast the Shell object as a Shouter and invoke the shout() function. Everything ok here.
Now let's say ShellLoader is run locally and is localTrusted. Shell.swf still lives on I'm now unable to use SecurityDomain property of LoaderContext within ShellLoader because it is now run locally. Shell.swf now exists in a different ApplicationDomain as my ShellLoader and I get the error "Type Coercion failed" when I try to cast the loader content as a Shouter.Is there anyway to resolve this issue? I believe it will require Shell.swf to be loaded in the same ApplicationDomain as ShellLoader but I don't know any way to do this when ShellLoader is run locally. Perhaps this is prevented in the Flash player on purpose?
View 7 Replies
Sep 1, 2009
I'm new to flash and actionscripting (i come from the land of ansi c but have traveled extensively). I've created a great animated animated 3d movie clip and want to have them generated on the stage in relation to an xml file. I've gotten this to work with a 2d movie clip but am running into problems casting a 3d object.my object (a movie clip - boxContainer with an instance name of boxContainer_mc) is built out of all movie clips in the following way (shown in tree form):[code]
View 6 Replies
Jan 14, 2010
I've been reading about this issue on the forums today, but I still don't understand what i'm doing wrong here:var theMC:String = "mcMenuItem1";var myX=[theMC];trace("myX = "+myX);myX.gotoAndStop(2);From what I've read, this should cast theMC string into a movie clip that exists on the stage, but I still get the error:TypeError: Error #1006: gotoAndStop is not a function.What am I doing wrong here? Or what is it that I've missed?
View 4 Replies
Jul 5, 2010
I wrote a post a week ago but it seems no one is able to help or I didn't explain my problem well enough, so here I go again.I want to load an external SWF, get an object reference from it and add it to the PV3D scene of my main class. The problem is even though the types have the same names, they are not recognized as the same type.
---------------------------------pv3Dviewer--------------------------- -----------
package {
import org.papervision3d.objects.primitives.Sphere;
public class pv3Dviewer extends Sprite {
[code]....
When pv3Dviewer is run, it traces "no". If I try to assign shereRemote without type casting i get this error:TypeError: Error #1034: Type Coercion failed: cannot convert org.papervision3d.objects.primitives::Sphere@59930b1 to org.papervision3d.objects.primitives.Sphere.
View 7 Replies
Oct 28, 2011
I'm having a casting issue that I am hoping to resolve. I have 2 arrays:
1st array = the clip's parent that I'm trying to target 2nd array = the clip I'm trying to target
When I trace the results, I can see the clip and the clip's parent, they exist on the stage and are qualified. When I try and get the clip by name in part 3, I get an Error #1009.
Can someone lend insight into what I'm doing wrong, or suggest a better way of doing what I'm trying to do?
[Code]...
View 3 Replies
Apr 27, 2010
How i can convert gecko object to a movie clip
function finish(boxname, arrayname:Array):void {
for each (var item:String in arrayname) {
trace(boxname+"_"+item);
[Code]....
View 2 Replies
Nov 9, 2011
I have tree instance calling an iconFunction "getIconFromItem".
<mx:Tree dataProvider="{collection}" iconFunction="getIconFromItem" />
The getIconFromItem function is returning null even though the bitmap is not null.
public function getIconFromItem(item:Object):Class {
var result:Class = item.icon as Class ;
return result ;
}
Setting a break point on the return result line reveals that item.icon is a bitmap and result is null.
how to successfully cast a bitmap as class so that the bitmap is returned as an icon?
View 2 Replies
Dec 9, 2010
I'm trying to convert a generic JSON object into a somewhat complex typed dto-like object that has the following properties:
firstName:String
lastName:String
contactInfo:Vector.<ContactInfo>
resources:Vector.<Resource>
The way I'm doing this is by giving the function metadata which sort of maps the JSON data properties to these data properties and their types, using reflection.So, I have a JSON object that might look something like this:
Code:
{
firstName: "John",
lastName: "Smith",[code].........
and that didn't even compile.
View 0 Replies
Mar 18, 2011
I have a situation where I am trying to build a path to an xml node like this:
Code:
var personName:Object = ["xmLoader.xmlData.profilepage.p"]+num+[".p1name"];
Where "num" is a number passed into to the function. What is happenning is when I trace out personName after this code I get:
"xmLoader.xmlData.profilepage.p2.p1name"
instead of the value that resides at that node name (I can trace out p1name which is John from my processed xml earlier in the code).
View 5 Replies
May 1, 2007
I have parsed the data from an xml doc to global vars in flash and need to use a few of them as numbers for things the position of "nodes" on the screen. However I can not cast the data stored as a var to a number or int value.
For example in the code below when the set Node button is pressed it traces the "Node's" current X value, then the value in the global var gotten from the xml, which contains the x position of where to place the Node.
Next it creates a new var of Number Type and assigns it the Number value of the string in global var. It then traces the new value of SNtopLeftX and sets the x pos of the Node's movie clip to the value of SNtopLeftX However the Node doesn't move and this is the output I get from the traces
Start Node is at x = -734.5
nod_topLeftX is 16
TopLeftX = 16
SN TopLeftX = NaN
I do not understand why I am getting NaN when the string of nod_topLefX is 16, any ideas?
------------------------------------------------------------------------------------------------------------------- This is my Code
butNodeSet.onRelease = function() {
trace ("Start Node is at x = " + mcStartNode._x);
trace ("nod_topLeftX is " + nod_topLeftX);
[code]....
View 2 Replies
May 26, 2010
I've got a placed png file in flash that is set to multiply for it's blending. It's a shadow.If I were to put an image below in the flash file it would look fine, however I'm having save it out as is and pass on to a developer who's laying the swf file over an image on a html page.When this is done the shadow looks bad as it's transparency fades through white, so when on a dark image in the html page it looks rubbish. Is there a way to achieve a good look as if the dark image was in flash? Should I be creating the shadows in photoshop differently?
View 1 Replies
May 3, 2010
I am trying to create a custom object in AS3 to pass information to and from a server, which in this case will be Red5. In the below screenshots you will see that I am able to send a request for an object from as3, and receive it successfully from the java server. However, when I try to cast the received object to my defined objectType using 'as', it takes the value of null. It is my understanding that that when using "as" you're checking to see if your variable is a member of the specified data type. If the variable is not, then null will be returned.
This screenshot illustrates that I am have successfully received my object 'o' from red5 and I am just about to cast it to the (supposedly) identical datatype testObject of LobbyData:
[Code]...
View 4 Replies
Sep 20, 2011
I have what I think should be a very simple problem. I have an array and can access an element of it like this:
var test = finalArray[0];
Will be a number between 1 and 7
say this will trace a number.No there is a movieclip on the root of stage whose name is a letter (always the same, say "R") and whatever the number is. I'm trying to get this movieclip to gotoAndStop at the frame corresponding to the number that is test. However this isn't working:
"R"+[test as MovieClip.gotoAndStop(test)];
View 3 Replies
Jan 31, 2012
[Code]...
so the problem is I can print the array but how to cast tht array to a known php type? After 5 days I finnaly figured out flex and mysql using amfphp
View 1 Replies
Sep 15, 2010
I have Input text field on Scene with instance name number_txt.[code]
View 9 Replies
Jan 28, 2011
I am using Flex 4 and for whatever reason I cannot get the following code to work which happens inside of a ListEvent handler for a dataGrid:
_tempRule = DataGrid(event.currentTarget).selectedItem as Rule;
Rule is a custom class, and the above code always returns null. The dataprovider for the datagrid is an ArrayCollection. If I try to wrap the above code to make it like the following:
DataGrid(event.currentTarget).selectedItem as Rule
I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert Object@e15a971 to com.mycompany.arcc.business.Rule
Now I know I have done this before with native Flex classes like Button, etc, but it my case it will not work. Here is the Rule class:
package com.mycompaany.arcc.business {
import flash.utils.describeType;
import mx.collections.ArrayCollection;
[Code] .....
View 2 Replies
Nov 3, 2009
I have imported a button made in photoshop as a PNG into Flash. I want to animate the shadow behind the button.
How do I make the shadow png. go from 0% to 100% transparent? I have tried altering the colour alpha option but as expected this doesnt work.
View 1 Replies
Oct 25, 2011
How do I remove my columns' shadow with CSS?
I know I could do this:
<mx:seriesFilters>
<mx:Array />
</mx:seriesFilters>
But I'd really like my CSS to control all the visuals.
View 1 Replies