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


Similar Posts:


ActionScript 2.0 :: Loading External Swf And Text File Into A Loader?

Apr 26, 2011

I want my product button to click on it, to load an external sfw into a loader and the text of this external swf too. The text is loading good when i click the swf file on its own, but with the index page not. when i click the product button the loader is loading only the swf file of product but not the text on it. The text is coded to the product swf.This is the code of index Page which i want to load the product page:

stop();

productMenu_btn.onRelease = function(){
myLoader.contentPath = "contents/lingerie/lingerie_page.swf"
}

and this is the code of the product page which is loading on the loader :

stop();

myData = new LoadVars();
myData.onLoad = function(success){
if (success){

[code]....

View 0 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

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 :: 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

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

ActionScript 3.0 :: Loading A File Of Any Type With Flash 9?

Oct 23, 2009

I'm trying to implement a feature in my Flash app that lets a user choose a file of a certain type (in this case it's a simple text file with a special extension) on their computer to the application and then use the data from the file within the application. I know this is possible with Flash 10 with the addition of the load method in FileReference, but, unfortunately, Flash 9 doesn't have that.

Is there any way to get Flash 9 to do this without having to resort to uploading to a server and then downloading from there?

(For anyone wondering why I'm so concerned with Flash 9, the simple answer is that my users might not be the most computer-savvy people, so we need to be as backward-compatible as possible.)

View 1 Replies

Flash - Type Not Found In External .as File?

Jan 24, 2012

I have an issue using external as files. I'm working with a Flash Professional project in Flash BuilderHere is some code on the timeline (I got the code like this, don't have the time to abandon this practice because of deadlines):

import com.companyname.AwesomeClass;
include "external.as";
And here's external.as

[code].....

View 2 Replies

ActionScript 3.0 :: Loading Buttons In MovieClip As External SWF File

Jun 27, 2009

I am working on a website, its a project, I built custom buttons and used there own AS3 to make them play on hover. There is one problem thou, in my main scene or timeline I created this function:

about_but.addEventListener(MouseEvent.CLICK, function(){
var aboutURL:URLRequest = new URLRequest("about.swf");
})
contact_but.addEventListener(MouseEvent.CLICK, function(){
var contactURL:URLRequest = new URLRequest("contact.swf");
})
cat_but.addEventListener(MouseEvent.CLICK, function(){
var galleryURL:URLRequest = new URLRequest("catalogue.swf");
})
port_but.addEventListener(MouseEvent.CLICK, function(){
var portURL:URLRequest = new URLRequest("port.swf");
})

Ok but it had the navigatetoURL function but I took it out. Reason is because I want these buttons to load in a movieclip (mc_loader) as external swf files. I am not sure as is to linking these buttons to the loader movieclip.

View 9 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

ActionScript 3.0 :: Flash Pre-loader - Load An External SWF File

Mar 12, 2009

I'm very new to flash - I'm trying to use a pre-loader that loads an external SWF file. Its working except the percentage in the bar is actually reflecting how much of the entire page is loaded, not how much of just the flash banner is loaded. The result is that the percentage bar is still visible over the top of the flash banner when it begins to play and the percentage bar continues to load until the whole page is loaded.

[Code]...

View 2 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

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 2.0 :: Loading An External Swf File/movieclip Onto The Main Stage?

Jan 7, 2009

I am loading an external swf file/movieclip onto the main stage - it is a simple transition and once it has finished playing, I want to jump to a frame in the main stage.I've loaded the movieclip onto the stage, but don't know how to jump to another frame after it has played and stopped...what's needs to be added to this to goto a frame on the main stage........

on (release) {
loadMovie("black.swf", holder);
}

View 2 Replies

ActionScript 2.0 :: Loading External Movieclip Into Scroll Movie Clip?

Jan 15, 2008

Loading external movieclip into scroll movie clip?

View 1 Replies

Image Processing - Loading .bmp And .tiff File In Flash 10 Using Loader?

Jan 21, 2010

I am developing a Image uploader using Flash 10. I am using Filereference object to browse images and Loader to show the image:

Sample code:

var tempFileRef:FileReference = FileReference(ev.target);
var oLoader:Loader = new Loader();
oLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad);
oLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
oLoader.loadBytes(tempFileRef.data);

It works fine with .jpg and .gif files but when I browse .bmp or .tiff file, I am getting the error:

Error #2124: Loaded file is an unknown type.

Is there a way to load and display browsed .bmp images from desktop?

View 2 Replies

ActionScript 2.0 :: FMX - Loading External Text File Into Movie?

Dec 5, 2002

I'm trying to get an external text file to load into my movie. I read the tutorial about the scrollbar w/ external text file but it's not really clear and it seems somewhat out dated... I'm anxiously awaiting ASDG2 coming out on December 19th. What would the code look like to load a text file called "theText.txt" into a text field called "theField_mc" created with AS itself attached to a mc called "theMC_mc" created with createEmptyMovieClip(); ? I'm trying to do this %100 AS, no instance manually put on the stage.

View 6 Replies

ActionScript 2.0 :: Preloading - Loading A External Swf File Into A Blank Movie Clip?

Jul 29, 2009

In what combination of as2 code would instruct a preloader to recieve bytes loaded and bytes total in addition to loading a external swf file into a blank movie clip? I've seen countless issues regarding the same problem but still haven't goten a clear answer. I dont want to use the video player component standard on Flash. I want a preloader to preload a external swf file and play it inside a movieclip.

View 5 Replies

ActionScript 2.0 :: Loading Into The Movie Loads A Easily Editable External XML File?

Sep 15, 2009

I know this goes against the logic of most menus. I am building a menu. I have very nice mc called "menu_list" and loading into the movie loads a easily editable external XML file with all my over categorys and sub menus

it looks like this...client.niallohara.net/xml_menu.html

[Code]...

View 0 Replies

ActionScript 2.0 :: Loading External XML On An External Server Into Flash Movie When It Is Uploaded

Jun 4, 2004

[FMX] I am having trouble loading an XML file on an external server into my flash movie when it is uploaded. The data loads in fine when the flash file is on my local computer with the xml file on a server. As soon as the flash file is uploaded the XML data will not load in.

View 2 Replies

Loading External Swf Using Loader?

Apr 14, 2010

I want to change the following code being used to load my external flash swf to an empty swf so that a loader is used instead of loadmovie:

var dewsliderpath = _root._url.substring(0, _root._url.lastIndexOf("/")) + "/dewslider_ori.swf?xml=" + xml;
DewSlider.loadMovie(dewsliderpath);

[code].....

View 1 Replies

ActionScript 3.0 :: Loading External Swf's Through 1 Loader?

Jan 9, 2010

when I run the code there aren't any errors stopping it from compiling correctly. However when I click on my buttons i get an error saying:

Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.

I'm guessing that I'm passing the variable off through the function incorrectly. I'd like it pass a string though so that I can pass the name of the file to load.

ActionScript Code:
function contentScreen(mcName):void {
var imageRequest:URLRequest = new URLRequest("mcName");
var imageLoader:Loader = new Loader();

[Code]....

View 3 Replies

ActionScript 3.0 :: Loading External SWF's Into A SWF Loader Style?

Nov 13, 2011

I've recently made the switch from as2 to as3 and am still struggling to get my head around one aspect in particular. I've managed to load one external swf into a blank file via the script
 
import LoadDisplayObject;  
var loader:LoadDisplayObject = new LoadDisplayObject("button_01.swf", true);
loader.addEventListener("displayObjectLoaded", onComplete, false, 0,

[Code]....  
 
.....however I'm struggling with the script to make a swfs load into a space when one of my 3 buttons is clicked....
 
My page currently has three buttons (button_01, button_02 and button_03) and in a local folder three separate swfs with the same names which I wish to load in, when the appropriate button is pressed. 
 
I have managed to get them to load in using a tutorial...however they load over the top of each over...far from ideal. From research on the internet I've found a range of different script...but I just can't find anywhere I can find script to make this work..hence why I have turned to here.
 
Any help much appreciated...thanks in advance.
 

View 9 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 3.0 :: 1118: Implicit Coercion Of A Value With Static Type Flash.displayisplayObject To A Possibly Unrelated Type Flash.display:MovieClip

Feb 11, 2010

I have a MC on my stage and I am trying to get it using the following:

var r: MovieClip = getChildByName('MyMovie');

I get an error:1118: Implicit coercion of a value with static type flash.displayisplayObject to a possibly unrelated type flash.display:MovieClip.

View 1 Replies

ActionScript 3.0 :: Loader Event/loading External Bitmaps

Nov 30, 2009

I have my .fla file and .swf file in a folder on my desktop

i want to add to that file a bitmap. everytime my flash project receives a the String "loadBITMAP" i want it to reload that bitmap into a designated area on the stage. (i am using a system of binary sockets to recieve data, but don't worry about that...i know how to process that already.) so basically my code will say

Code:
if(socket.readUTFBytes="loadBitmap"){
need code here on how to load bitmap
}

View 21 Replies

Professional :: Load An External Swf Using A Loader To Show While Its Loading

Jul 26, 2010

how to load an external using a loader to show while its loading...my swf which is to be loaded is a gallery having jus one frame on which action script is placed..

View 10 Replies

ActionScript 3.0 :: UI Loader Content Scaling - Loading External SWF

Aug 18, 2009

I've devised a preloader using the ui loader and progress bar components in flash cs3. The goal being to load an external .swf into the uiloader and that has been achieved. I'm having problems with the scaling now. In my code I have set the content scaling to "true" and that isn't supposed to cause distortion of any type but it does. It squishes my external .swf in width wise.

HTML Code:
var imageURL:String = "portfolio.swf";
var imageURLRequest = new URLRequest(imageURL)
uiLoader.scaleContent = true;
uiLoader.load(imageURLRequest);
progressBar.source = uiLoader;
[Code] .....

View 1 Replies

ActionScript 3.0 :: Custom Loader Class - Loading External SWF In FLA

May 17, 2009

I've been trying to figure this out for the past couple of days and couldn't find a solution and Im sure its something I have completely overlooked on my part. I'm attempting to load in an external swf in my fla file using this custom loader class I created. I keep receiving this error in an attempt to load the swf, which is in the same directory as my fla file that is loading it:

TypeError: Error #2007: Parameter url must be non-null.
at flash.display::Loader/_load()
at flash.display::Loader/load()
at com.proj.load::SWFLoadClass()
at test_fla::MainTimeline/frame1()

Code from SWFLoadClass.as:
package com.proj.load {
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.MovieClip;
[Code] .....

Code in fla file:
import com.proj.load.SWFLoadClass;
var l:SWFLoadClass = new SWFLoadClass("colorPicker.swf", 0, 0);
addChild(l);

View 1 Replies

ActionScript 3.0 :: Implicit Coercion Of A Value Of Type Flash.display:MovieClip To An Unrelated Type Class?

Aug 15, 2011

These are my errors: in Adobe Flash CS5.5
 
I don't understand why this script doesn't work. I am new to Action Script 3.0 and I watched this incomplete video on youtube. -- [URL] and I got the fails below.

[Code].....

View 1 Replies







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