Dynamic Text in Externally Loaded swf
hi. i have a dynamic text field in an externally loaded swf. Its a digital clock so i want the numbers to update in the dynamic text field.
this is not my exact code but it is very similar. i show below that i add the loader.swf, and once its loading is complete, i can work on its movieclips and add event listeners to its buttons, etc. but i cannot change the dynamic text field (its "classic text" set to "dynamic text"). after running this, the text just stays empty as it is in the external swf).
here is the sample code:
var loader:Loader = new Loader();
loader.load(new URLRequest("loader.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded);
function loaded(event:Event):void{
addChild(loader);
var loader_mc:MovieClip = (loader.content as MovieClip)
loader_mc.myMovieClip.gotoAndStop(2);//***this works
loader_mc.myButton_btn.addEventListener(MouseEvent.CLICK, clickMe);//***this works
loader_mc.myText_txt.text = "12";//***this doesn't work******
please help. thanks!
Did you embed the font in the textfield--it needs to be done in the loaded swf when you create it? One other thing to check is that the color for the textfield is not the same as the background it sits on.
Similar Messages
-
Using the DateField in an Externally loaded SWF
Hello,
I have been having major trouble trying to get a basic PHP
contact form to work within an externally loaded SWF file inside of
a parent SWF. When I test the movie on its own it seems to work
fine (example: I'm able to select a date from the DateField
component). However, when I open up the parent SWF file and call
the external SWF file with the form the DateField is basically
unusable (example: when you click on it nothing happens, no
calendar pops up to select a date).
I have no ActionScript on it yet, simply because I figure I
need it to work before I tell it what to do with the PHP file. The
instance name on the DateField is "theDate". Any help is very much
appreciated. Thank you.
Also, I have just successfully used the contact form on the
web. But, the only user interface components I am able to edit are
the input text boxes, not the DateField or the ComboBox I have in
it as well. This is very odd, I was not aware that anything special
had to be done using these UI components within an external file.
ElijahHello 2m,
Maybe if you were to see it, it may help you out a bit. If
you
click
here for the external file you will see that the components are
working. However, if you
click
here for the parent file and then click on "Meetings" on the
top menu you will see that they do not work at all. However, if
someone were to hit the "send" button, the PHP code would actually
interact with the form. Let me know if that helps at all. Thanks
again for replying.
Elijah -
How can I make my external loaded .SWF file smoothly disappear after 15 seconds?
Hi,
How can I make my external loaded .SWF file smoothly disappear after 15 seconds? The following is the code to load an external .SWF file:
var K:Loader=new Loader();
addChild(K);
K.load(new URLRequest("clock.swf"));
K.x = 165;
K.y = 247;
K.contentLoaderInfo.addEventListener(Event.INIT, growLoader);
function growLoader(evt:Event):void {
K.width = 130;
K.height = 130;
I want to make clock.swf file disappear from the page after 15 seconds using some smooth disappear effect.
Please help.
Thanks.Something even better:
http://www.greensock.com/
Check out TimelineMax I LOVE it...
The guy that made this (and gives it away for free!) is a saint. -
Passing events from externally-loaded SWFs
Hi,
We have an externally-loaded swf that acts as a kind-of-a slide show. After a user selects a particular subject from a mxml-based "menu" application, they push "buttons" in the SWF to go through a presentation, then on the last frame of the swf, I'd like to unload the swf and replace it with another "mxml" application. How can this be done? I have not tried to pass/capture events "up" from an externally-loaded swf before.
Thanks,
DougDo you own those SWFs? If so, they should dispatch an event from a known
place like a SlideShowManager or something like that.
Other folks "cheat" and bubble events or dispatch off of the systemManager
and/or top-level application. -
Dynamic Text with external .txt files
I need help getting dynamic text to display. I've used the
following tutorials (among others).
http://www.kirupa.com/developer/mx/dynamic_scroller.htm
http://www.kirupa.com/developer/mx/multiple_dynamictext.htm
In Flash 8 on last frame of maintimeline of movie, I have a
layer with a background image, 2 buttons and a dynamic textbox
(made scrollable) with scrollbar component. Textbox is given a var
of "content", and an instance name of "textBox", which is
referenced in scrollbar parameters.
I have created 3 text .txt files, and saved them to same
folder with movie .swf file. Text in files is preceeded by
"content=" on line preceeding text to correspond with var of
dynamic textbox. The files were created in Rich text format on Mac
OSX4.11 and saved with .rtf extension, then file extension was
changed to .txt (wouldn't save as .txt)
I've added the following actionscript to this last frame:
loadText = new LoadVars();
loadText.load("TEXTintro.txt");
//creating the loadVarsText function
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
Buttons have an instance name assigned with the following
actionscript:
on (release) {
loadText = new LoadVars();
loadText.load("TEXT1.txt");
loadText.onLoad = function(success){
if (success){
textBox.text = this.content;
else{
trace("Error loading external content");
When I test movie, I can see buttons on last frame of movie,
but they don't load any text when pressed, and "undefined" text
appears in upper left corner of text box before I press either
button.
I am getting the following Output errors:
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 1: Statement block must be terminated by '}'
on (release) {
**Error** Scene=MoonOfWintertime, layer=TextBox,
frame=2500:Line 11: Syntax error.
Total ActionScript Errors: 4 Reported Errors: 4No more output errors, buttons still not working, but I got
my intro .txt file to load in textbox that loads with frame using
the following code I tried from another tutorial:
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXTintro.txt");
Tried the following code with buttons, but doesn't work.
Other code suggestions?
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
loadText.load("TEXT2.txt");
on (release) {
loadText = new LoadVars();
loadText.onLoad = function() {
textBox.html=true;
textBox.htmlText = this.textContent;
loadText.load("TEXT1.txt");
} -
Dynamic text not appears on swf export
This was posted in the 'Getting Started' Forum, but no
repsponses, so I am trying my luck here =)
I am new to Captivate, so bear with me.
I have created a Flash file that calls externally text to be
loaded into a scrolling text field. This works fine as a standalone
swf. When I import the swf into Captivate, I can see the dynamic
text appear in the small preview pane of the import window, but NOT
when I publish the Captivate movie. I have made sure to include the
external txt files in the same directory.
Any ideas on what I could be doing wrong?
TIA,
DebHi Deb
I'm going to reply where your question was initially asked,
so we can keep the forums a bit tidier. I'm also inserting a link
here that will lead others to the initial post.
Click
here to view the thread where the question was initially asked.
Cheers... Rick -
Linking a class to a dynamic text field to load XML data.
Hi,
I'm quite new to ActionScript and would be grateful for any help here.
I want to load text into a dynamic text field (called 'about_tab') using a class depending on the language selected (by clicking on a flag icon) by the user.
I managed to get this to work when the ActionScript was written directly in the timeline, but am having problems with doing the same thing via a class.
This is my class file:
package
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.Event;
public class ChangeLang extends SimpleButton
public function ChangeLang()
addEventListener(MouseEvent.CLICK, switchLang);
trace("ChangeLang class working");
public function switchLang(event:MouseEvent):void
var lang = event.target.name;
var req:URLRequest = new URLRequest("languages/"+lang+".xml");
var loader:URLLoader = new URLLoader();
var substance:XML;
function xmlLoaded(event:Event):void
trace("function xmlLoaded is running");
substance = new XML(loader.data);
about_tab.text = substance.about_lbl;
loader.addEventListener(Event.COMPLETE, xmlLoaded);
loader.load(req);
Here's one of my XML files (the other is the same except "About" is written in German):
<substance>
<about_lbl>About</about_lbl>
</substance>
When I run it, it returns my trace statements that the class ChangeLang and the function xmlLoaded are running, but no text appears in the dynamic text field (I should/want to see the word 'About'). I get this error message:
1120: Access of undefined property about_tab
The problem, I'm guessing, is in the part in red in my code. I think I need to target the text field in the display list by creating a reference to it. If so, could someonw point out how I do this, or perhaps a tutorial that would help. I've tried adding the word stage (i.e.,stage.about_tab.text = substance.about_lbl; ) but it still doesn't connect. I guess there's something really simple I'm missing, so I apologize if this comes across as a stupid question
Thanks for any help.Hello flashrocket!
I'm also new to AS3 and I've just started using external classes and I think I know what you should do to put your code to work.
Instead of using the text field you created inside your flash file, why don't you use the "TextField" class to create an instance of this object? It's the exact same thing as when you create and instantiate a new text field inside Flash.
First, import flash.text.*; (includes classes like TextField, TextFieldAutoSize, TextFormat, TextFormatAlign, etc)
Than you just have to create a var like
public var about_tab : TextField;
or
public var about_tab : TextField = new TextField();
then, to adjust the properties of this tab you use dotsyntax as if it where on your stage like:
about_tab.x = 50; about_tab.alpha = .5; etc...
you can even create a function to "config your textField"
private function createAndConfigTextField() : void {
about_tab = new TextField(); //you only need this line if you
// only typed something like "public var about_tab:TextField;
// if instead you used "public var about_tab:TextField = new TextField(); outside
// this function, just skip this first line because you already have an instance of
// text field named "about_tab"...
about_tab.autoSize = TextFieldAutoSize.CENTER;
about_tab.background = true;
about_tab.border = true;
var aboutTextFormat : TextFormat = new TextFormat();
format.font = "Arial";
format.color = 0x000000;
format.size = 11;
format.bold = true;
format.align = TextFormatAlign.CENTER;
about_tab.defaultTextFormat = aboutTextFormat;
addChild(about_tab);
This is just an example of what you can do... I hope you get it... let me know if you have any doubt... -
How to unload externally loaded swf which contains 3D Carousel?
Hello to all
I am learning AS3 and have been taking on various tutorials found on the net. While learning about AS3 I came across a lesson on http://tutorials.flashmymind.com/2009/05/vertical-3d-carousel-with-actionscript-3-and-xml/ titled "Vertical 3D Carousel with AS3 and XML".
I completed the tutorial and all worked fine so I then wanted to load the swf into a existing project. The loading of the swf goes fine and when I unload my loader it is removed but only visually as in my output panel in flash CS5 I get an error as follows
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at carousel_c_fla::MainTimeline/moveCarousel()
this error repeats over and over again slowing my swf movie.
So does this mean my main flash movie trying to still play / find my unloaded 3D Carousel?
If so how do I unload remove all the AS3 that is trying to run from the 3D Carousel?
I have included the AS3 below from the tutorial page and I understand that this is what I have to remove to "break free" from the 3D Carousel swf when it is unloaded. This is where I am stuck as my knowledge of AS3 is limited - Can you guys / girls help?
//Import TweenMax
import com.greensock.*;
//The path to the XML file (use your own here)
// old var from tutorial - var xmlPath:String = "http://tutorials.flashmymind.com/XML/carousel-menu.xml";
var xmlPath:String = "carousel-menu.xml";
//We'll store the loaded XML to this variable
var xml:XML;
//Create a loader and load the XML. Call the function "xmlLoaded" when done.
var loader = new URLLoader();
loader.load(new URLRequest(xmlPath));
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//This function is called when the XML file is loaded
function xmlLoaded(e:Event):void {
//Make sure that we are not working with a null variable
if ((e.target as URLLoader) != null ) {
//Create a new XML object with the loaded XML data
xml = new XML(loader.data);
//Call the function that creates the menu
createMenu();
//We need to know how many items we have on the stage
var numberOfItems:uint = 0;
//This array will contain all the menu items
var menuItems:Array = new Array();
//Set the focal length
var focalLength:Number = 350;
//Set the vanishing point
var vanishingPointX:Number = stage.stageWidth / 2;
var vanishingPointY:Number = stage.stageHeight / 2;
//We calculate the angleSpeed in the ENTER_FRAME listener
var angleSpeed:Number = 0;
//Radius of the circle
var radius:Number = 128;
//This function creates the menu
function createMenu():void {
//Get the number of menu items we will have
numberOfItems = xml.items.item.length();
//Calculate the angle difference between the menu items (in radians)
var angleDifference:Number = Math.PI * (360 / numberOfItems) / 180;
//We use a counter so we know how many menu items have been created
var count:uint = 0;
//Loop through all the <button></button> nodes in the XML
for each (var item:XML in xml.items.item) {
//Create a new menu item
var menuItem:MenuItem = new MenuItem();
//Calculate the starting angle for the menu item
var startingAngle:Number = angleDifference * count;
//Set a "currentAngle" attribute for the menu item
menuItem.currentAngle = startingAngle;
//Position the menu item
menuItem.xpos3D = 0;
menuItem.ypos3D = radius * Math.sin(startingAngle);
menuItem.zpos3D = radius * Math.cos(startingAngle);
//Calculate the scale ratio for the menu item (the further the item -> the smaller the scale ratio)
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the menu item according to the scale ratio
menuItem.scaleX = menuItem.scaleY = scaleRatio;
//Position the menu item to the stage (from 3D to 2D coordinates)
menuItem.x = vanishingPointX + menuItem.xpos3D * scaleRatio;
menuItem.y = vanishingPointY + menuItem.ypos3D * scaleRatio;
//Add a text to the menu item
menuItem.menuText.text = item.label;
//Add a "linkTo" variable for the URL
menuItem.linkTo = item.linkTo;
//We don't want the text field to catch mouse events
menuItem.mouseChildren = false;
//Assign MOUSE_OVER, MOUSE_OUT and CLICK listeners for the menu item
menuItem.addEventListener(MouseEvent.MOUSE_OVER, mouseOverItem);
menuItem.addEventListener(MouseEvent.MOUSE_OUT, mouseOutItem);
menuItem.addEventListener(MouseEvent.CLICK, itemClicked);
//Add the menu item to the menu items array
menuItems.push(menuItem);
//Add the menu item to the stage
addChild(menuItem);
//Assign an initial alpha
menuItem.alpha = 0.3;
//Add some blur to the item
TweenMax.to(menuItem,0, {blurFilter:{blurX:1, blurY:1}});
//Update the count
count++;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveCarousel);
//This function is called in each frame
function moveCarousel(e:Event):void {
//Calculate the angle speed according to mouseY position
angleSpeed = (mouseY - stage.stageHeight / 2) * 0.0002;
//Loop through the menu items
for (var i:uint = 0; i < menuItems.length; i++) {
//Store the menu item to a local variable
var menuItem:MenuItem = menuItems[i] as MenuItem;
//Update the current angle of the item
menuItem.currentAngle += angleSpeed;
//Calculate a scale ratio
var scaleRatio = focalLength/(focalLength + menuItem.zpos3D);
//Scale the item according to the scale ratio
menuItem.scaleX=menuItem.scaleY=scaleRatio;
//Set new 3D coordinates
menuItem.xpos3D=0;
menuItem.ypos3D=radius*Math.sin(menuItem.currentAngle);
menuItem.zpos3D=radius*Math.cos(menuItem.currentAngle);
//Update the item's coordinates.
menuItem.x=vanishingPointX+menuItem.xpos3D*scaleRatio;
menuItem.y=vanishingPointY+menuItem.ypos3D*scaleRatio;
//Call the function that sorts the items so they overlap each other correctly
sortZ();
//This function sorts the items so they overlap each other correctly
function sortZ():void {
//Sort the array so that the item which has the highest
//z position (= furthest away) is first in the array
menuItems.sortOn("zpos3D", Array.NUMERIC | Array.DESCENDING);
//Set new child indexes for the item
for (var i:uint = 0; i < menuItems.length; i++) {
setChildIndex(menuItems[i], i);
//This function is called when a mouse is over an item
function mouseOverItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 0.1, {alpha: 1, glowFilter:{color:0xffffff, alpha:1, blurX:60, blurY:60},blurFilter:{blurX:0, blurY:0}});
//This function is called when a mouse is out of an item
function mouseOutItem(e:Event):void {
//Tween the item's properties
TweenMax.to(e.target, 1, {alpha: 0.3, glowFilter:{color:0xffffff, alpha:1, blurX:0, blurY:0},blurFilter:{blurX:1, blurY:1}});
//This function is called when an item is clicked
function itemClicked(e:Event):void {
//Navigate to the URL that's assigned to the menu item
var urlRequest:URLRequest=new URLRequest(e.target.linkTo);
navigateToURL(urlRequest);Hi Ned thanks for the reply,
Ok so I have a button in my main movie that loads the external swf
stop();
var my_loader:Loader = new Loader();
var my_btn:Button = new Button();
var my_pb:ProgressBar = new ProgressBar();
my_pb.source = my_loader.contentLoaderInfo;
my_btn.addEventListener(MouseEvent.CLICK,startLoading);
function startLoading(e:MouseEvent):void{
my_loader.load(new URLRequest("carousel.swf"));
addChild(my_pb);
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishloading);
function finishloading(e:Event):void{
addChild(my_loader);
my_loader.addEventListener("killMe",
killLoadedClip);
removeChild(my_pb);
function killLoadedClip(e:Event):void {
my_loader.removeEventListener("killMe",
killLoadedClip);
my_loader.unloadAndStop();
removeChild(my_loader);
Then I have a button in my loaded swf that closes the loader
This is spread over 2 frames
Frame1
function closeIt(e:MouseEvent):void {
parent.dispatchEvent(newEvent("killMe"));
Frame 2
back_btn.addEventListener(MouseEvent.CLICK, closeIt);
Frame 2 also holds all the code for the carousel
Thanks for your time and help in advance people ; ) -
Map and externally loaded swf working together
Here's the setup:
I have a panoramic viewer, and i'd like to have a map go
along side it. The panoramas are loaded externally into the player.
Inside these external swf files are "hotspots" that link to other
panoramic swf files that load and take the previous swf's place. I
have all of this set up, and you can see how I did it in my
previous post:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1274410&enterthread=y
So now my new question is... how can I have a map with points
on it, that when you click on a point, it will load a corresponding
swf file into the player. I believe that part is easy. My big
problem is if someone clicks on a hotspot in the external swf file
first, which in turn loads another swf file, and if that person
goes back to the map, I want the map to change the position of lets
say, a marker or a pin to indicate the new position on the map that
correllates to the new external swf that was loaded.
make sense? Any ideas? I was thinking maybe it would be some
kind of listener or something so that should a specific swf load,
it will recognize it and automatically change the location of the
marker on the map to the point that relates to the loaded swf or
something...Hi Thanks for your reply, I tried with a small AS3 file as
well and I get the same ERROR. -
Dynamic text resizes when loaded?
I made sure to set the stage to noScale but I am still having
a strange problem that is driving my nuts. If I make a static text
box it will not resizing when I compile and preview or upload the
swf. However, if I make a dynamic text box, the text size increases
slightly when i complile the swf. This makes fine tuning the layout
of web pages extremely difficult because what i see on the stage is
not the same size as what i see when the swf is complied. Has any
one else had this problem or know how to solve it because its
really starting to drive me nuts?The only time you should see a size difference is when you
take text out of a movie clip that has been scaled. Hit Crtl-t to
get the Transform window and see if the object is %100 -
Setting External Loaded SWF dimension
hi guys...,
i'll be straight to point,well i'm now working on a project using action script 3 now what i'm trying to make is a Main SWF that load whatever other swf into it the tricky thing is that i used 1 xml document read the external swf source and it's setting(such as it's x,y position and it's width and height) and i'm having problem setting the loaded swf width and height btw it's an desktop application and not a website application.,
here is my code:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.INIT, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
and here is what the result ( it make the width and height of the loaded swf to 0):
swfLoader.contentLoaderInfo.width : 320
swfLoader.contentLoaderInfo.height : 240
module: MyVideo/flvplayer.swf
x:0
x container:0
y:0
y container:0
xml width:550
width container:0
xml height:400
height container:0
myCounter: 1
swfLoader.contentLoaderInfo.width : 550
swfLoader.contentLoaderInfo.height : 400
module: AnalogueClock.swf
x:50
x container:50
y:0
y container:0
xml width:250
width container:250
xml height:200
height container:200
myCounter: 2
swfLoader.contentLoaderInfo.width : 800
swfLoader.contentLoaderInfo.height : 30
module: MyNewsticker/newsticker.swf
x:0
x container:0
y:0
y container:0
xml width:300
width container:0
xml height:50
height container:0
most of my loaded swf beside the analouge clock is full action script code and in case of the analouge clock it is a swf that has a movie clip on it's stage (the other are fully created from action script 3.0)
please do help me..,
cause i'm already really desperate and going crazy by this problem..,sorry i copied the code from the other swf i used to do try and error test..,
basically the container is the same as swf varibale
here the code so you would'nt get confused:
//variable list
var swfList:XMLList; //hold all the zone list from the xml
var totalZone:uint; //total of zone there is in the xml
var myURLLoader:URLLoader = new URLLoader();
var swf:Movie Clip;//hold the loaded swf
var swfLoader:Loader = new Loader();//loader instance used to load the external swf
var myCounter:uint = 0;
//load the xml file
myURLLoader.load(new URLRequest('myXMLFile.xml'));
myURLLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
function processXML(e:Event):void
removeEventListener(Event.COMPLETE, processXML);
XML.ignoreWhitespace= true;
var myXML:XML = new XML(e.target.data);
swfList = myXML.SWF;
totalSWF = myXML.SWF.length();
loadSWF();
function loadSWF():void
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfSetting);
swfLoader.load(new URLRequest(swfList[myCounter].@source));
function swfSetting(e:Event):void
//making new instance of sprite to hold the new loaded swf
swf = new MovieClip();
//casting the loader content into a movieclip
swf = e.target.content;
addChild(swf);
swfLoader.unload();
swf.x = swfList[myCounter].@left;
swf.y = swfList[myCounter].@top;
swf.width= swfList[myCounter].@width;
swf.height= swfList[myCounter].@height;
addChild(swf);
if(myCounter < totalSWF)
myCounter++;
trace('myCounter: ' + myCounter );
loadSWF();
well in my code i did cast the loader into a movie clip and then set it's width and heigt,right???
wouldn't it just give me the same result??
if it's not can u describe what u mean in more detail??
some example about accessing the loader content would be really appreciated -
Color external loaded swf in AS3 Help Urgent!
Hi i have loaded swf from an external path using the following command.
var cviewer:Loader=new Loader();
var curlRequest:URLRequest=new URLRequest("clipArts/"+evt.target.name);
So this is the scenario.
Suppose say i load Movie1.swf
I have three movie clips inside Movie1.swf called step0, step1, step2
I need to change the color of step0, step1 and step 2 from the parent flash file which loads movie1. All the inner movie clips color may be different from each other.
I am able to change the color of the whole movie clip by using
var colorInfo:ColorTransform = cviewer.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
cviewer.transform.colorTransform=colorInfo;
But not of individual ones. I even tried cviewer.step0.transform.colortransform and other stuff to see if it would work. But nothing worked. Help at fastest would be deeply appreciated.
Regards and thanks in advance.try:
var colorInfo:ColorTransform = MovieClip(cviewer.content).step0.transform.colorTransform;
colorInfo.color=evt.target.selectedColor;
MovieClip(cviewer.content).step0.transform.colorTransform=colorInfo; -
Using a transition on an externally loaded swf
Hi, I would have no problem doing this the old fashioned way,
but for some client-requested reason it has to be in AS3. Here's
what I have:
var myLoader:Loader = new Loader();
addChild(myLoader);
var url:URLRequest = new URLRequest("movie.swf");
myLoader.load(url);
//Fade-in 9 seconds
TransitionManager.start(myLoader, {type:Fade,
direction:Transition.IN, duration:9, easing:Strong.easeOut});
Apparantly, myLoader isn't the instance name of the loded
swf. I have no idea what it is though. Can someone help me? Thanks!The loaded swf is at loader.content, but you can only access
it once the loading has completed and the loader has been added to
the display list. For example, CODE 1 will not work, but CODE 2
will.
//CODE 1
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest("movie.swf"));
var loadedSwf:MovieClip = MovieClip(loader.content); //ERROR
//CODE 2
var myLoader:Loader = new Loader();
addChild(myLoader);
myLoader.load(new URLRequest("movie.swf"));
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
loadCompleted);
var loadedSwf:MovieClip;
function loadCompleted(ev:Event):void {
loadedSwf = MovieClip(loader.content);
trace(loadedSwf);
PS. I recommend using the Tweener library for tweening in
ActionScript. It is much better than the Adobe functions and there
is a tutorial at:
http://gotoandlearn.com/player.php?id=45 -
"Detecting" a variable from an externally-loaded SWF via SWFLoader
I load an external SWF file from a click event. Then, when the interactions has reached the end of the presentation, we'd like it to unload itself, and go into another state.
Is that possible? ( actually transformed the SWF into a component using Flash Builder 4 hoping that would be easier to detect variables and events)
Thanks,
DougIt is possible, but you'll have to wire up the communications between the
SWFs -
Trying to get a movieclip to display on top of an externally loaded swf
I am trying to ensure that a movieclip named "Incorrect"
displays on top of a swf file that loads with the following:
loadMovieNum("map.swf",1);
I'm sure it's pretty simple, but I couldn't find any good
reference to a movieclip loading on top of an external swf. I tried
loading the map.swf into a placeholder movieclip and doing a
swapDepth, but then the code within the map.swf would no longer
function properly.
thanks.you must load that movieclip into a _level greater than 1.
there is no work-around if you load map.swf into _level1.
you could load map.swf into a target movieclip and then use
the swapDepths() method of movieclips to control the apparent depth
of map.swf and your movieclip.
Maybe you are looking for
-
Blue Screen Error on Windows 7 - Event ID 41
Hi, I have encountered a recurring problem with my Windows 7 for the last 2 weeks. The blue screen error keeps popping up every other day or so. The problem seems to come from Kernel-Power, which is according to the report. Here are my laptop specs a
-
Forgot my security question answers, how do I reset them?
I forgot my security question answers...... How can I reset them??? Help!!!
-
How do I change the country of the AppStore ?
I bought my iPad in panama but I live in Costa Rica and cannot buy at the AppStore they do not accept my payment method
-
Crystal Reports 9 - Installation on Server 2008
Hi, I have moved our installation of Crystal 9 from server 2000 on to a Server 2008 x64 r2 and am having a few little issues: The program has installed and ran correctly, but when it goes to open a file it comes up saying: 'Failed to open the documen
-
AS 2 for infinite slide show loop
I don't know if there is a simple answer to my question. Here goes. I created an infinitely looping series of photos that scrolls from right to left. The animation was created with 6 photos and was animated using AS 3. Is there substitute coding usi