Flash CS3

Free tutorials and scripts for all

Sometimes members don't get their activation email.
This happens because it gets deleted by accident, your spam folder gets it ... lots of reasons.
To Resend the account activation code you need to do two things:
1. Go here: Resend your activation email
2. Enter the email address you used when you signed up and click "Email activation codes"
3. When the email arrives in your inbox, be sure to click the link to activate your account.

loading extern .swf

This is a discussion on loading extern .swf within the advanced Actionscript 3.0 forums, part of the Flash CS3 eng category; hi@all, i have a little problem with loading an extern .swf. I am working on a Adobe AIR Project, ...


Go Back   Forum Flash CS3 > English Forums > Flash CS3 eng > advanced Actionscript 3.0

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-07-08, 18:00
Junior Member
 
Join Date: Jul 2008
Location: Germany
Posts: 6
Rep Power: 0
iphone747 is on a distinguished road
loading extern .swf

hi@all,
i have a little problem with loading an extern .swf. I am working on a Adobe AIR Project, with Flash CS3 and the AIR Update. For my AIR Project i will use the Chatopica chat
link:Free Web Chat Widget - Chatopica

But if i load the chat into my basic .fla and start it i become an error message.

i used this script for loadind the extern .swf:

HTML Code:
var request:URLRequest = new URLRequest("http://static.chatopica.com/chat.swf?=v0.9");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);
and this is the error message:

HTML Code:
SecurityError: Error #2047: Verletzung der Sicherheits-Sandbox: parent: http://static.chatopica.com/chat.swf?=v0.9 kann nicht auf app:/Teeworlds2.swf zugreifen.
    at flash.display::DisplayObject/get parent()
    at mx.managers::SystemManager/executeCallbacks()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::docFrameHandler()
I hope that anybody can help me with this problem

Thanks @all
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-07-08, 17:26
xInstinct's Avatar
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: loading extern .swf

Hi,
Try and add the loader only once it has completed loading.

Code:
loader.addEventListener(Event.COMPLETE, addToStage);

function addToStage(e:Event)
{
     addChild(loader);
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-07-08, 18:28
Junior Member
 
Join Date: Jul 2008
Location: Germany
Posts: 6
Rep Power: 0
iphone747 is on a distinguished road
Re: loading extern .swf

hi xInstinct,

i tried it but if i start nothing appears. No error message and no chat. I hope that i paste your code correctly here is the complete script:

HTML Code:
var request:URLRequest = new URLRequest("http://static.chatopica.com/chat.swf?=v0.9");
var loader:Loader = new Loader()
loader.addEventListener(Event.COMPLETE, addToStage);

function addToStage(e:Event)
{
     addChild(loader);
}
Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-07-08, 18:47
xInstinct's Avatar
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: loading extern .swf

When I go the the link for the SWF file, It asks me to download it. What I'd do is download the file to your computer, into the same folder as your new .fla file, and make your code;

Code:
var request:URLRequest = new URLRequest("chat.swf");
var loader:Loader = new Loader()
loader.addEventListener(Event.COMPLETE, addToStage);

function addToStage(e:Event)
{
     addChild(loader);
}
See if that works :)

xInstinct
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-07-08, 19:05
Junior Member
 
Join Date: Jul 2008
Location: Germany
Posts: 6
Rep Power: 0
iphone747 is on a distinguished road
Re: loading extern .swf

Thanks a lot.
If i used your code i have the same problem, but if i used the idea with the download file with this code it works.

HTML Code:
import flash.display.*;
import flash.net.URLRequest;
var rect:Shape = new Shape();
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.drawRect(0, 0, 1024, 768);
addChild(rect);
var ldr:Loader = new Loader();
ldr.mask = rect;
var url:String = "chat.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.load(urlReq);
addChild(ldr);
but now i have the next Problem. The Chat appears in his full widh. Is it possible to change the widh?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-07-08, 19:27
xInstinct's Avatar
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: loading extern .swf

Ugh, sorry, I didn't have all the necessary code....

Code:
import flash.display.*;
import flash.net.*;
import flash.events.*;

var ldr:Loader = new Loader();

var url:String = "chat.swf";
var urlReq:URLRequest = new URLRequest(url);
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, addMe);
ldr.load(urlReq);

function addMe(e:Event)
{
    addChild(ldr);
}
That should be much more stable

Lemme look at the resizing...

xInstinct
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-07-08, 20:12
xInstinct's Avatar
Flasher
 
Join Date: Jun 2008
Location: Texas
Posts: 42
Rep Power: 0
xInstinct is on a distinguished road
Send a message via AIM to xInstinct
Re: loading extern .swf

Alright, the resizing is actually a problem...

if you took your ldr...
Code:
ldr.width = 100;
ldr.height = 100;
It won't work, right?
However, this works by scaling the loaded SWF file by 50%;
Code:
ldr.scaleY = 0.5;
ldr.scaleX = 0.5;
But that can affect the quality of your SWF file...
So what about making a Sprite, or a MovieClip, and loading the SWF file into that:
Code:
var mySprite = new Sprite();
mySprite.x = mySprite.y = 15;
mySprite.width = mySprite.height = 200;
addChild(mySprite);

// In the function //
mySprite.addChild(ldr)
//  end function //
That didn't work for me either...
So, I went to the stage, drew a rectangle the width and height I wanted, and converted it to a movieclip, Also exporting it to ActionScript 3! So now you have the movieclip in your library, and it is the width and height you want!

So say you made your movieclip and called it "holder"
then you can do this;
Code:
var myMC:holder = new holder()
myMC.x = myMC.y = 15; 
// If you want to change height
// or width again, then...
// myMC.width = myMC.height = 200
addChild(myMC);

// in the function //
myMC.addChild(ldr);
// end function //
Should work, it just worked for me (my code is a bit different though as my project is different, but same concept)

xInstinct.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 Loading a photo gallery swf dodapb Flash CS3 eng 0 05-07-08 22:00
Loading The ReflectGallery skateblade HELP free utilities 0 29-06-08 19:02
Dynamic loading BeechyBoy PHP | mySQL | Flash CS3 1 14-05-08 12:53
Loading SWF from Compressed File ajayghe Flash CS3 eng 5 31-01-08 04:07
SWF Not Loading into HTML File Vudrok Actionscript 3.0 newbies 2 28-09-07 16:25


All times are GMT. The time now is 03:20.


Powered by vBulletin versione 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap