Controling objects in a loaded swf at any given time
I want to communicate with an object within a loaded swf. I know I can use this event listener and function to do so right when the swf has completed loading:
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadSections)
function loadSections(event:Event):void
event.target.content.mc.y+=2
But I want to be able to manipulate a given object from the loaded swf at any time not just when the loading is complete. So basically as long as the swf is loaded, is there a way to manipulate objects and call functions within that swf?
Both the external and host swf are AS3.
Thanks
I'll just try to add to what Ned already told you.
IF (and only if) I understood what you're trying to do, all you want is press a button to load a new SWF and then click the loaded swf to unload it, right?
If this is what you want, I think you have to understand that a loader IS a displayObject and it CAN be added to the displayList. It took me a lot of time to understand this so maybe this is where you're having trouble to "think" your application (and I guess it is because you're using holder.addChild(imageLoader);, which is not wrong).
Since a loader is a displayObject that can be added to the displayList, you don't really need a another displayObject do hold it, like a holder.
You can simple use addChild(imageLoader);
Doing so, you will have a "loader" on stage working just like anyother displayObject. You can add listeners to it, you can remove it from stage, change its location and all.
So, as Ned said, when you add a loader to the stage, if you want to remove it, go ahead an remove it!
removeChild(imageLoader);
//or, in your case:
holder.removeChild(imageLoader);
The only thing here (as far as my knowledge goes) is that the loaded content still exists EVEN if it doesn't exist on the displayList anymore. That's why you MUST unload it TOO.
imageLoader.unload();
Doing so you'll send the loader content for GarbageCollection and this will be deleted when more memory is needed.
Another best practice I've noticed is that you should avoid from "creating" a loader from withing a function.
Well, just to give you an idea of what you can do:
import flash.events.MouseEvent;
var req:URLRequest = new URLRequest("external.swf");
var loader:Loader = new Loader();
//A button we have on the timeLine.
myBtn.addEventListener(MouseEvent.CLICK, onClick);
function imageLoaded (e:Event):void {
addChild(loader);
loader.addEventListener(MouseEvent.CLICK, unloadAndRemove);
trace (loader is DisplayObject);
function unloadAndRemove (e:MouseEvent):void {
e.target.unload();
removeChild(loader);
function onClick(e:MouseEvent):void {
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(req);
I hope it helps.
Similar Messages
-
Total of the number of stock lines held in storage at any given time
Hi Experts,
Is there a transaction we could use that will quickly give us a total of the number of stock lines held in storage at any given time? can anyone please advise
Many ThanksSolved.
SE16 and table LQUA or LAGP. LAGP is more logical but takes longer to generate the result.
Regards
Simon -
Only one Airport Express will work at any given time
Hi,
I use one Airport Express to connect to the internet and another to stream iTunes to my Stereo.
I can only get one to work at any given time!
If I use Airport SetUp Assistant to reconfigure the one that isn't working, it starts and the other stops.
I can only ever see the current one in Airport Admin Utility.
Airport SetUp Assistant shows me two.
What's up?
Best regards,
Ronnie
OSX.4.7
iMacG5 & MacBook Mac OS X (10.4.7)Have a look here and read it carefully.
http://docs.info.apple.com/article.html?artnum=107454
Cheers Don -
HELP !! only one ASM instance up at any given time on a 2 node RAC cluster
OS: Solaris 10
Oracle: 10.2.0.4
Problem: Installing ASM, dbca hangs, and errors out with End of communication channel.
Only one ASM instance can be brought up at any given time
PLEASE HELP !!!!
- nkalert log
======
Thu Oct 1 23:09:54 2009
lmon registered with NM - instance id 1 (internal mem no 0)
Thu Oct 1 23:09:54 2009
Reconfiguration started (old inc 0, new inc 12)
ASM instance
List of nodes:
0 1
Global Resource Directory frozen
Communication channels reestablished
Thu Oct 1 23:24:59 2009
Errors in file /oracle/admin/+ASM/bdump/+asm1_lmon_1999.trc:
ORA-00481: LMON process terminated with error
Thu Oct 1 23:24:59 2009
LMON: terminating instance due to error 481
Thu Oct 1 23:24:59 2009
System state dump is made for local instance
Thu Oct 1 23:24:59 2009
Trace dumping is performing id=[cdmp_20091001232459]
Thu Oct 1 23:25:00 2009
Instance terminated by LMON, pid = 1999
Thu Oct 1 23:25:03 2009
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Interface type 1 bge1 192.168.10.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge0 10.134.246.32 configured from OCR for use as a public interface
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /oracle/product/10.2.0/db_1/dbs/arch
Autotune of undo retention is turned off.
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.4.0.
System parameters with non-default values:
large_pool_size = 12582912
instance_type = asm
cluster_database = TRUE
instance_number = 1
remote_login_passwordfile= EXCLUSIVE
background_dump_dest = /oracle/admin/+ASM/bdump
user_dump_dest = /oracle/admin/+ASM/udump
core_dump_dest = /oracle/admin/+ASM/cdump
asm_diskgroups =
Cluster communication is configured to use the following interface(s) for this instance
192.168.10.1
Thu Oct 1 23:25:03 2009
cluster interconnect IPC version:Oracle UDP/IP (generic)
IPC Vendor 1 proto 2
PMON started with pid=2, OS id=17923
DIAG started with pid=3, OS id=17925
PSP0 started with pid=4, OS id=17927
LMON started with pid=5, OS id=17929
LMD0 started with pid=6, OS id=17931
LMS0 started with pid=7, OS id=17933
MMAN started with pid=8, OS id=17937
DBW0 started with pid=9, OS id=17939
LGWR started with pid=10, OS id=17941
CKPT started with pid=11, OS id=17943
SMON started with pid=12, OS id=17945
RBAL started with pid=13, OS id=17955
GMON started with pid=14, OS id=17957
Thu Oct 1 23:25:04 2009
lmon registered with NM - instance id 1 (internal mem no 0)
Thu Oct 1 23:25:04 2009
Reconfiguration started (old inc 0, new inc 14)
ASM instance
List of nodes:
0 1
Global Resource Directory frozen
Communication channels reestablished
Thu Oct 1 23:40:09 2009
Errors in file /oracle/admin/+ASM/bdump/+asm1_lmon_17929.trc:
ORA-00481: LMON process terminated with error
Thu Oct 1 23:40:09 2009
LMON: terminating instance due to error 481
Thu Oct 1 23:40:09 2009
System state dump is made for local instance
Thu Oct 1 23:40:09 2009
Trace dumping is performing id=[cdmp_20091001234009]
Thu Oct 1 23:40:10 2009
Instance terminated by LMON, pid = 17929
Thu Oct 1 23:40:12 2009
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Interface type 1 bge1 192.168.10.0 configured from OCR for use as a cluster interconnect
Interface type 1 bge0 10.134.246.32 configured from OCR for use as a public interface
Picked latch-free SCN scheme 3
Using LOG_ARCHIVE_DEST_1 parameter default value as /oracle/product/10.2.0/db_1/dbs/arch
Autotune of undo retention is turned off.
LICENSE_MAX_USERS = 0
SYS auditing is disabled
ksdpec: called for event 13740 prior to event group initialization
Starting up ORACLE RDBMS Version: 10.2.0.4.0.
System parameters with non-default values:
large_pool_size = 12582912
instance_type = asm
cluster_database = TRUE
instance_number = 1
remote_login_passwordfile= EXCLUSIVE
background_dump_dest = /oracle/admin/+ASM/bdump
user_dump_dest = /oracle/admin/+ASM/udump
core_dump_dest = /oracle/admin/+ASM/cdump
asm_diskgroups =
Cluster communication is configured to use the following interface(s) for this instance
192.168.10.1
Thu Oct 1 23:40:13 2009
cluster interconnect IPC version:Oracle UDP/IP (generic)
IPC Vendor 1 proto 2
PMON started with pid=2, OS id=26086
DIAG started with pid=3, OS id=26088
PSP0 started with pid=4, OS id=26090
LMON started with pid=5, OS id=26092
LMD0 started with pid=6, OS id=26094
LMS0 started with pid=7, OS id=26096
MMAN started with pid=8, OS id=26100
DBW0 started with pid=9, OS id=26102
LGWR started with pid=10, OS id=26112
CKPT started with pid=11, OS id=26114
SMON started with pid=12, OS id=26116
RBAL started with pid=13, OS id=26118
GMON started with pid=14, OS id=26120
Thu Oct 1 23:40:13 2009
lmon registered with NM - instance id 1 (internal mem no 0)
Thu Oct 1 23:40:14 2009
Reconfiguration started (old inc 0, new inc 16)
ASM instance
List of nodes:
0 1
Global Resource Directory frozen
Communication channels reestablished -
Control main timeline from loaded swf.
Hi,
I'm using a textfield for debug information.
I'm loading an swf on the main timeline and I'm showing the status in the debug textfield.
function swfLoaderCompleteHandler(event:Event)
Debug.text += "Swf loaded.";
That works.
But,
I'm loading a png file in the loaded swf. , I'm trying to show the status of the png file as I showed the status of the swf.
function pngLoaderCompleteHandler(event:Event)
MovieClip(parent).Debug.text += "Png loaded.";
I can't control the main swf from inside the loaded swf. Even gotoAndStop or calling a function doesn't work.
Do I need to add something when I load the swf, saying it's a MovieClip or something?
Here's a fla too. http://flashfocus.nl/forum/attachment.php?attachmentid=9885&d=1282509233Thank you! you're brilliant!
For people with the same problem:
If you use CS5 and you have a TLF text on the stage, it doesnt work... I think it's a bug. But when I converted my TLF textfield to classic and everything works fine! -
Extract y value from graph at any given time
I have a graph with a pre-plotted curve generated from a standard set of results. I need to extract the y value of the curve at any given point. My y value is pressure and my x value is stroke(hydraulic cylinder movement in mm). So for example at 10mm(x value) I need to extract the pressure(y value). Is there a property node I could use for this? any help would be much appreciated.
Hi Alan,
instead of reading values from the graph you may use the interpolation functions from the array palette to do interpolation on the plotted values directly...
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
See the user's hostname when doing transactions at any given time.
Hi SAP Experts,
I want to see the hostname it used the user when the user is executing a transaction at a particular date and month. And current condition Security Audit not active. Can I see this? I can see on tCode ST03N (1 month ago), but I can't see detail the hostname.
Do I need to enable Security Audit (SM19) if I want to track user activity? Is it necessary for security reasons?
Please advice for active strategy schedule Security Audit because if it is activated storage will fill up quickly.
Thanks,
MarjanHi Marjan,
Without enabling the Security Audit, You can't find the required details like hostname/Terminal, User, Tcode/Report... Use SM19 to enable the Audit functionality and check for information in SM20.
Yes, Definitely storage will fill up if you activate this functionality but it will helps you alot.
If you are using Production Server, you must enable for security and audit purpose.
You can activate for Development, Quality and Test purpose systems, if required otherwise no need..
Ask me if you have any queries..
Regards
Santosh K -
Syntax to export 18 months of data at any given time using variables?
I have written a calculation script for exporting data from an application using DATAEXPORT. I want to get 18 months of data in my exported text files at any point of time. So, I want to specify the range using variables for Period and Year but I am kind of stuck on how should I be writing it in my script.
Please let me know the correct syntax using variables or if you could share some link that would help me know that would be a help.
Can I use @XRANGE Function???
Thanks !Srinivas --> Thanks for clarifying that. After I read your post I did go through the @XRANGE again and noticed that they had use cross dimensional operators so it put me in a confusion. But you cleared it by being more specific this time. Thanks a lot !
If I follow what Robb suggested then like you mentioned when 3 years will be involved its going to be difficult I guess. Not sure at this point which way would be the best to get this work.
I agree with CL - 18 months rolling forecast can be annoying seriously.
Can one of you please suggest me a permanent and most efficient solution for this out of all the ideas that would not require manual work and can be automated completely?
Thank you all for your inputs. I really appreciate it.
Edited by: 892254 on Nov 3, 2011 6:30 AM -
Communicating to a loaded .swf
So, I have finally figured out how to preload, and gotten my main movie to load an external swf properly. My last hang up, is how to speak to that loaded swf, with a button added above it in the main timeline.
So, my button is Nextbtn (added via addChild), and my swf is titled "about_mov.swf", when it is loaded, it goes to frame 10 and stops, what I want to happen, is when you click the NextBtn, that loaded swf advances to frame 11. Just not sure how to reference it properly, and hping i can get a quick solution on it. Thanks!if you want to load and display more than 1 swf at any given time, you'll need to use more than 1 loader. further, if you want to reference those swfs you'll need to use different references for the loaders.
-
Can't Access MovieClips and Functions in Loaded SWF
Hi everybody,
I'm trying to simply access anything inside this loaded SWF and all I get is 'null'.
I have code in the parent SWF that needs to tell the child SWF movieclip what to do but nothing works. This was a piee of cake in AS2 and I can't seem to get anything to crossover in AS3.
Here's my code:
import com.greensock.TweenMax;
import flash.display.MovieClip;
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder
myLoader.load(url); // load the SWF file
panel2.addChild(myLoader); // add that instance to the display list, adding it to the Stage at 0,0
panel2 = myLoader.content as MovieClip;
photo_about.alpha = 0;
photo_downloads.alpha = 0;
//panel2.content_about.alpha = 0;
//panel2.content_downloads.alpha = 0;
function closeSection():void
panel2.controlsMC.forcePause();
TweenMax.to(photo_about, .5, {alpha:0});
TweenMax.to(photo_downloads, .5, {alpha:0});
TweenMax.to(photo_home, .5, {alpha:0});
TweenMax.to(panel2.content_about, .5, {alpha:0});
TweenMax.to(panel2.content_downloads, .5, {alpha:0});
TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
TweenMax.to(panel2.content_home, .5, {alpha:0});
panel2 traces null and all the clips loaded within pull up undefined property errors.
Can somebody please tell me what I'm doing wrong? I'd be stoked to know what I'm missing and feel like this should be a piece of cake.
Thanks for any help!You are not adding the content to the stage at 0,0, you are adding it to panel2 at 0,0. THen you take panel2 and assign it to be something that likely doesn't exist by the time you assign it. You need to wait until the loader completes loading before you attempt to do anything with its content, otherwise it has no content (null). Similarly, you cannot control anything in the loaded swf until it has finished loading. So assign an event listener to the contentLoaderInfo property of the Loader to determine when loading is complete, and have the event handler function deal with starting the interaction with it.
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf");
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, processLoadedSWF);
myLoader.load(url);
function processLoadedSWF(evt:Event):void {
// deal with the loaded swf here
// but you don't want to be assigning it to the panel2 object that contains the loader
As far as controlling anything inside the swf you load, is it an AS1/2 or an AS3 swf? -
Trouble Playing A loaded 'SWF' file in the pain timeline
Hey there. I have created a presentation that loads
interactive SWF movies into a 'target' movie clip on the main
timeline.
As you progress through the presentation different SWF movies
are loaded into the presentation. And this in turn allows me to
change the presentations content quickly and easily for different
clients.
These SWF's use some of the flash preloaded content objects
like combo box's and the like.
However when these SWF's are called into the main
presentation they cease to work properly.
They work fine when tested independently of the main
presentation.
Does anyone know how I may be able to get these SWF's to work
properly?
Cheers FletchThe first thing to do is check the scoping in your loaded
SWF. Any references to _root, for example, mean something different
once the SWF is loaded into your wrapper movie.
Also, some of the V2 components don't work properly when
their SWF is loaded into another SWF. There's a Tech Note and easy
workaround here:
http://www.adobe.com/go/tn_19278
Good luck! -
How Many Enterprise Resources Can Be Checked-Out at Any One Time?
Hi Folks,
Using Project Server Online, I am trying to select and edit a resource pool containing approximately 1200 enterprise resources in MS Project Professional 2013. I can open a few at a time, but when I "select all" it does not do anything.
Is there a limit on how many enterprise resources we can check out at a time?
Thanks in advance,
\Spiro Theopoulos PMP, MCITP. Montreal, QC (Canada)OK..I was able to edit 495 resources at a given time. The moment I click 496th resource, nothing happens when I click the Open in Project button.
So, to Dale's point, there seems to be some kind of limit on the number of resources that can be edited at any given time, but what's puzzling is that the limit seems to be different for every tenant.
I will try and find more information, but at this point, the solution is something you already know. Edit few resources at a time.
Cheers,
Prasanna Adavi, Project MVP
Blog:
Podcast:
Twitter:
LinkedIn:
-
(AS3) Controlling Loaded SWF
I am trying to control a loaded .swf with the parent .swf. I
do not know how to call the loaded .swf. I know how to control the
parent with the child, but not the other way around. any
suggestions would be great. thanks!call on the Loader object where the movie is being held.
You'll need to typecast like this....
MovieClip(Loader.contentLoaderInfo.content). My recommendation is
to store that path to a variable
var myLoadedMovie:MovieClip = MovieClip(
varNameOfMyLoader.contentLoaderInfo.content);
change out the varNameOfMyLoader with the proper variable
name and you should be able to target the movieclip as you would
have done in AS2. -
Controling a loaded swf with another loaded swf
I have a blank stage with only AS that loads an swf
addChildAt(0) and a second one addChildAt(1). This works. When the
user interacts with (1) it calls another addChild (not indexed) and
possibly that one loads another, depending on the choices made by
the user. How can I get any of these to control that very first
child that was loaded at (0)? I have run out of ideas.
Some of the code:
(on the main swf, nothing on the stage, only code that loads
the next two)
addChildAt(pHolder, 0);
pLoader.load(pURLReq);
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
pLoaded);
and for the second:
addChildAt(mHolder, 1);
mLoader.load(mURLReq);
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
mLoaded);
On the child of childAt(1), I have:
function replaceSWF(e:MouseEvent):void
pLoader = new Loader();
pLoader.load(new URLRequest("p.swf"));
pLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
placeNewClip);
function placeNewClip(e:Event):void
removeChildAt(0);
addChildAt(e.target.content, 0);
If I use this exact same code from that very first swf, the
one that loads the first two external swfs, it works, but once I
put it on one of hte other loadeds and sub loaded swfs, I can't get
it to work. In the current state (0) it just makes everything on
the stage disappear, so I figured then using the index of (1) would
do it, but that or any other number results in absoluly nothing.
Help! I am really out of ideas here.
(the stacking looks like this) ---
sub second loaded SWF <==== needs to tell first loaded SWF
to unload then load a new swf at same index
second loaded SWF <==== loads the next one above
first loaded SWF <=== needs to be removed and another swf
loaded at the same index
mainSWF (loads two others) <=== code placed here works for
first loaded SWFKglad,
I tried your code and ran into some problems with stopping
the mc's, as the embedded mc's within the loaded swf need to stop
as well. I found the attached code to stop the mc's, but now am
having trouble with the sound objects.
Here's the issue, I used this:
this.soundPosition = currentMovie.loop1.position/1000;
this.currentMovie.loop1.stop();
... for the sound object stop commands and listed a new one
for each loop I was using. On the play button I started them back
up again. This all works, but when I start them up again they all
play, not just the one that is currently paused. Do you mind giving
me some guidance with the for (obj in mc) loop? My loop experience
is nil. What I want to do is have the code cycle through all of the
loops to see which one is playing, then store that information in a
variable, then pause and play the variable. Does that sound right?
Thanks again for the help!
-Sandy -
Controlling loaded swf rewind?
Hi there, I need to bring the playhead to the begining (rewind) each time the onsound button is clicked. But a loadimage function was used to load the swf. Any ideas?
Hi there! here is the script as is...I picked the project up from another coder and am still learning AS3 but think the loadimage function might be hindering the video control?
import flash.events.Event;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;
SoundMixer.soundTransform = new SoundTransform(1, -1);
var imageLoader:Loader;
function loadImage(url:String):void {
// Show Preloader
preloader.visible = true;
// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loadImage("trailer_02.swf");
function imageLoaded(e:Event):void {
// Load Image
imageLoadArea.addChild(imageLoader);
var myTransform:SoundTransform=SoundMixer.soundTransform;
myTransform.volume=0;
SoundMixer.soundTransform=myTransform;
// Hide Preloader
preloader.visible = false;
mc_Title.visible = false;
mc_frame.mc_vignette.visible = false;
btn_OFF.visible = true;
function imageLoading(e:ProgressEvent):void {
// Get current download progress
var loaded:Number = e.bytesLoaded / e.bytesTotal;
// Send progress info to "preloader" movie clip
preloader.SetProgress(loaded);
///////////// BUTTON FUNCTIONS /////////////////////////
btn_ON.visible = false;
btn_OFF.visible = false;
btn_ON.addEventListener(MouseEvent.CLICK, soundOnOff);
btn_OFF.addEventListener(MouseEvent.CLICK, soundOnOff);
function soundOnOff(event:MouseEvent):void
if (event.target == btn_ON)
btn_OFF.visible = true;
btn_ON.visible = false;
//SoundMixer.stopAll();
var myTransform:SoundTransform=SoundMixer.soundTransform;
myTransform.volume=0;
SoundMixer.soundTransform=myTransform;
else if (event.target == btn_OFF)
btn_ON.visible = true;
btn_OFF.visible = false;
var myTransform2:SoundTransform=SoundMixer.soundTransform;
myTransform2.volume=1;
SoundMixer.soundTransform=myTransform2;
Maybe you are looking for
-
Hi, I created a report which just run a sql query and give the output correct. The code was select target_name,target_type, column_label, warning_threshold,critical_threshold,occurrence_count from sysman.MGMT$TARGET_METRIC_SETTINGS I added a drop dow
-
Time Capsule, External HDD as NAS, Time Machine Backup the NAS
Can I attach an external HDD to Time Capsule to use as a NAS? Then can I use Time Machine on my Macbook to backup both my Macbook and the NAS drive to the HDD in the Time Capsule?
-
For loading AuC's through AS91, the field capitalized on is a required field. How to make it optional. I have seen in the screen layout, there are fields under Posting Information, "capitalization date" which is opitonal but did not see Capitalized o
-
Grab from an instance within split join
Hi All I have a process, and every now and then a user from role 'G' wants to grab the instances of a process (that may exist in any activity) to one of his activities, say 'AAG' (Activity After Grab :)). The Grab activities properties are defined so
-
Uneditable text on a WordPress site ?
Hi all, I'm working on a friend's site. My problem is that the pages display some text that is impossible to edit. I don't know how to edit the text's inline styles either. Because I don't know in which file the text is located. It's nowhere on the s