ActionScript 3.0 :: Cross-scripting And Type-casting?

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


Similar Posts:


ActionScript 3.0 :: Cross-scripting TypeError #1034 For The Same Type

Jun 28, 2010

I have the following problem. I am trying to load custom PaperVision3D objects from an externally loaded SWF in a simple FLARToolKit example project. The external SWF is compiled with the same libraries included in its path as the loading project. I will include only the pertinent functions in order to save some space. Both the external SWF and the loading project include security definitions to allow for access:

[Code].....

View 1 Replies

Flash :: AS3 Cross-scripting Between 2 SWFs?

Aug 13, 2010

I have a movie with a document class (Main.as) wich load 2 SWF:

private var mainContainer:Sprite = new Sprite();
addChild(mainContainer);
var loaderx:Loader = new Loader();[code]....

Now I need to access some var/objects in PhotoLoader from PhotoViewer but anytime I compile PhotoViewer the compiler complains:

trace(root.loaderx.dbFields);

1119: Access of possibly undefined property loaderx through a reference with
static type flash.display:DisplayObject.

Notice I need communication between the 2 loaded SWFs, not from the movie that loaded them

View 1 Replies

ActionScript 3.0 :: Cross Domain Scripting: Error #2048?

May 13, 2009

This is my first entry in this forum but I already found a lot of answers by browsing it.However, altough many references seem to solve the problem I'm hurting on, it doesn't seem to work for me...Now, here's the case:I made a flash web site that will be hosted on an external web server (let's call it serverMy flash needs to get some info from my internal server don't have access to the root, only to the folder «myfolder» so my website reads like this

View 1 Replies

Professional :: Cross-Site Scripting To Embedding Page

Mar 23, 2010

Here is my situation:
 
I have a Flash file hosted at:
 
http://static.mydomain.com/flash.swf
 
I have a web page that embeds that Flash file at:
 
http://www.mydomain.com/embed.html
 
The <embed> code for that SWF has the "allowScriptAccess" parameter set to "sameDomain". Currently, I cannot put links in "flash.swf" that change the location of the embedding page, because they are on different domains, and making a getURL() or ExternalInterface call won't be permissible.
 
Changing "allowScriptAccess" to "always" is not an option. Putting both files on the same domain is also not an option.
 
Policy files don't seem to be the solution (perhaps I'm coding them wrong?) and changing the "document.domain" of the embedding page doesn't seem to work either.

View 1 Replies

Flex :: Preventing Cross Site Scripting Attack On Flash Container Pages

Jun 2, 2011

I have a website with a flex application. The flex application has no user input - except for clicks for navigation. The website also uses no scripting language - i.e. no php, asp, jsp or cfm.

The website just consists of one page which contains the flash file for the flex application. The source code of this page is here: [URL]

I have been advised (by a software program used by my client) that this website is vulnerable to a reflective type XSS attack and have been advised to 'sanitize' all user input.

respect to XSS and would respectfully like to ask that AFAIK there is no user input. What should I sanitize and how?

View 1 Replies

Actionscript 3 :: Casting One Type To Another?

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

ActionScript 2.0 :: Casting String Gotten From Xml To A Number Type?

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

Flash :: Loading An External SWF File Into A Loader Movie And Type Casting To MovieClip

Nov 13, 2009

I am trying to import a SWF file into a custom loader and then treat the loaded SWF file as a MovieClip object. The code for the functionality can be seen below.

public function loadMyMovie(movie:String)
{
var now:Date = new Date();
var rnd:String = "?randomize=" + now.time;

[Code].....

When I do this I get the following error.

"Implicit coercion of a value with static type flash.display:DisplayObject to a possibly unrelated type flash.display:MovieClip."

View 2 Replies

Flex :: Type Coercion Error When Casting An Object Loaded In A Different Application Domain

Apr 28, 2011

My application currently contains a number of Widgets that are managed by a Widget Manager. When the user clicks on a widget (e.g. a Helper widget), the Widget Manager loads the widget into a separate sibling application domain with the following line of code:

wgtInfo.load(null, null, null, moduleFactory); //wgtInfo = IModuleInfo

However, I am unable to use the widget's variables and functions later on. I attempt to find the Helper widget from the Widget Manager's list of widgets, and I do successfully. But when I try to caste the Helper Widget from type IBaseWidget (the interface all widgets share) to type HelperWidget, I receive the following error:

TypeError: Error #1034: Type Coercion failed.....

This is because the application domain of the class trying to use the Helper widget is different from the application domain of the Helper Widget. I tried to fix this by loading all widgets into the same application domain as the loader:

wgtInfo.load(ApplicationDomain.currentDomain, null, null, moduleFactory);

I now get the following error whenever I attempt to load the Helper widget:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

How can I load my Helper widget into a common application domain that is accessible by the other widgets?

View 3 Replies

Flex :: "Type Coercion" Error When Casting To Interface

Jul 15, 2009

This is the error I am getting in the handleModuleReady function:

[Fault] exception, information=TypeError: Error #1034: Type Coercion failed:
can not convert MyModule@39b8479 to IModuleInterface.

I have an application setup and I have created modules to load at runtime in order to decrease the filesize (as most users will only ever need one of the modules).

<!-- maker.mxml -->
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*"

[code].....

View 2 Replies

ActionScript 2.0 :: Cross Domain SendAndLoad Via Cross Domain Script

Nov 5, 2010

My swf works fine when previewed locally but because of flash cross domain issues (link below) doesnt work live. [URL] Ive used a 'crossbrowser.php file to .load in xml but am not having success with the sendAndLoad command. [URL]

View 3 Replies

Flex :: Screen Casting Using 4.5

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

ActionScript 3.0 :: Casting Variables Into Functions?

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

AS3 :: Casting A Subclass Into A Parent Variable?

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

Actionscript 3 :: Implement Casting For Own Class?

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

Flex :: Casting Failed When Used Swf Loader?

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

ActionScript 3.0 :: Difference In Casting 'as' Or Object()

Nov 4, 2010

What is exactly difference between casting with np: DisplayObject(myObj) or
myObj as DisplayObject

View 9 Replies

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

ActionScript 3.0 :: Casting A Remote-loaded SWF?

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

ActionScript 3.0 :: Casting A 3d Movie Clip

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

Professional :: Casting String To Movie Clip?

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

ActionScript 3.0 :: Casting Results In Error #1009

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

Flash :: Casting Variables To Movie Clip?

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

Actionscript :: Correctly Casting A Bitmap To A Class?

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

ActionScript 3.0 :: Implicit Casting Between Vector Types?

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

ActionScript 3.0 :: Casting A String To Be A Resource Path?

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

ActionScript 3.0 :: Flash Casting Shadow / Light In 2d?

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

Actionscript 3 :: Casting An Object Using 'as' Returns Null MyObject?

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

Flash :: Casting Array Item To Reference MovieClip In AS3?

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







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