RemoveChild and unload
It seems like the removeChild and unload method do the same
thing. Is it necessary to do both when you're removing the display
of an external swf from the stage?
Also, after loading in an external file then running code to
remove it, whether you use removeChild, unload, or both, the sound
will continue even though the movie is removed from the
DisplayList/stage. I've found a workaround which is using
Loader.content with the stop method and it works fine. However I am
wondering why the sound would continue even though removeChild
and/or unload removes the movie from the DisplayList/stage.
Thanks...
Brenda
The only way the Flash player will stop a sound from an
external SWF is by properly garbage collecting the sound object and
all of its events. This will only be done when there is absolutely
nothing referencing the object or any of its events.
The difference between removeChild and unload, is that unload
removes the content of the loader object, whereas removeChild can
potentially remove the loader object itself from the display
list.
Similar Messages
-
Loading and unloading xml galleries
I have a several galleries that I will be loading via several xml files. Gallery1 will load on start and the other galleries will load through buttons using their instance names (i.e. "gallery3" button will load "gallery3.xml"). Currently I have a function + listener (called "home") to initiate gallery1 on start, a function + listener (called "goSection") to initiate the other galleries via button instance name, and a function that loads the gallery (called "fileLoaded") with the listener located in the "home" and "goSection" functions. There is a lot more code in the fileLoaded function that controls the thumbnail and full size images functionality that I am excluding because its probably not necessary for my problem. Im not sure the most efficient way to set this all up so I unload the existing gallery before I load a new gallery. Ive tried to use removeChild and removeEventListener on urlLoader without much success. Any suggestions? ...
//BUTTONS
var sButtons:Array = [gallery1,gallery2,gallery3,gallery4];
function sButtonsListeners():void {
for (var i:uint = 0; i < sButtons.length; i++) {
sButtons[i].addEventListener(MouseEvent.CLICK, goSection);
sButtonsListeners();
var urlLoader:URLLoader = new URLLoader();
//INIT HOME
function home():void {
trace("gallery1 loaded");
//load external xml
var urlRequest:URLRequest = new URLRequest("gallery1.xml");
urlLoader.load(urlRequest);
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
home();
//GO SECTION
function goSection(event:Event):void {
trace(instanceName + " loaded");
var instanceName:String = event.currentTarget.name;
//load external xml
var urlRequest:URLRequest = new URLRequest(instanceName + ".xml");
urlLoader.load(urlRequest);
urlLoader.addEventListener(Event.COMPLETE,fileLoaded);
function fileLoaded(event:Event):void {
var myXML:XML = new XML();
var xmlList:XMLList;
myXML.ignoreWhitespace = true;
var arrayURL:Array = new Array(); //thumbnails
var arrayName:Array = new Array(); //large photos
var holderArray:Array = new Array(); //thumbnail holder
var thumb:Thumbnail; //represents Thumbnail.AS
//represents the gallery container
var sprite:Sprite = new Sprite();
addChild(sprite);
//thumbnail container
var thumbsHolder:Sprite = new Sprite();
sprite.addChild(thumbsHolder);
//image container
var imageHolder:Sprite = new Sprite();
sprite.addChild(imageHolder);
//load image
var imageLoader:UILoader = new UILoader();
imageLoader.buttonMode = true;
imageHolder.addChild(imageLoader);
myXML = XML(event.target.data);
xmlList = myXML.children();
for (var i:int=0; i<xmlList.length(); i++) {
var picURL:String = xmlList[i].url;
var picName:String = xmlList[i].big_url;
arrayURL.push(picURL);
arrayName.push(picName);
holderArray[i] = new Thumbnail(arrayURL[i],i,arrayName[i]);
holderArray[i].name = arrayName[i];
holderArray[i].buttonMode = true;
holderArray[i].y = 25;
holderArray[i].x = i * 87 + 142;
thumbsHolder.addChild(holderArray[i]);Anyone? My biggest concern is unloading the existing gallery before I load a new one. Currently they load on top of each other.
-
How to load and unload Multiple External SWF
hello there,
i need help to figuring out how to load and also unload(removing) multiple external SWF.
so here is what i;m trying to do,
i want to load multiple external SWF and play it on my main SWF now i hove no problem with just loading multiple SWF and placing it in the display list .The problem came up when i tried removing those loaded SWF from the display list ,The problem exist because i have no way to refer to what i have loaded and placed on the display list,
i used a single loader instance to load all that external swf,
i do know that we have to remove all the event listener related to the external SWF that we want to remove and for this purpose i have crated a function called destroy which the main objective for this function is to remove all event listener inside the swf and also isolating all variable so it would be eligible for garbage collecting, here is what the code look like:
// Create this in every object you use
public function destroy():void
// Remove event listeners
// Remove anything in the display list
// Clear the references to other objects, so it gets totally isolated
sorry it just a kind of pseudocode cause this function will customize with it's own property i did this just for the purpose of simplicity and easy understanding..,
so now back to main problem how should i solve this problem??
i tried used an arraf to save all the loaded swf
the array is just used to save the what the loader is loading but the adding to display method is using
movieClipActAsContainer.addChild(e.target.content); //the event is from the Event.COMPLETE
but i have a hard time using that arrya back and matching it to the one i got from the display list.
please do help me,
any suggestion would be greatly appreciated,
and if can pleas show me a source code or pseudocode of what you're suggesting to me cause my english is not so fluent yet,
thanks before.Hey EI,
I had done this kind of project recently and for loading and unloading different swfs. I had used loaders specific to that filename and for removing I had used a single movieclip instance name and on clicking that specific loader request name that needs to be removed will be requested from the specific function. As mentioned below
Loading SWF:
===============================
swfLoaderIndia.load(swfRequestIndia);//This will load the request
If you are inside a movieclip while requesting use below code
MovieClip(this.root).addChild(swfLoaderIndia);//This will load swf on stage
or else
Stage.addChild(swfLoaderIndia);
Unloading SWF
=====================================
If you are inside a movieclip while requesting use below code
MovieClip(this.root).removeChild(swfLoaderIndia);//This will unload swf on stage
or else
Stage.removeChild(swfLoaderIndia);
Above code will be in specific function which will be requested when the loading and unloading is required.
I hope this helps you in your project.
With Regards,
Sagar S. Ranpise -
Display/load and Unload SWF in flex
hi friends
i wnat to disply external SWF file into flex but without using SWFLOader(it's make lot's of problem) nad i also Embed that SWF
this is code
[Embed(source="1.swf")]
private var loadswf:Class;
private function load():void{
var symb:MovieClip = new loadswf() as MovieClip;
this.addChild(symb);
it's give me error....
TypeError: Error #1034: Type Coercion failed: cannot convert demos_loadswf@39ab3c1 to mx.core.IUIComponent.
please help to resolve this error or give me suggestion to simple Disply/Load and Unload Embed SWF file in flexthnx Flex harUI
i added UI componentes now my full code is like..
import mx.controls.Image;
import mx.controls.Alert;
[Embed(source = "1.swf")]
public var SWF:Class;
[Embed(source = "2.swf")]
public var SWF2:Class;
private var mc:MovieClip;
private var img:Image;
protected function checkBtn_clickHandler(event:MouseEvent):void
clear();
img = new Image();
img.width=Number("700");
img.height=Number("700");
mc = new MovieClip();
mc = MovieClip(new SWF());
img.source = mc;
vBox0.addChild(img);
protected function critcalBtn_clickHandler(event:MouseEvent):void
clear();
img = new Image();
img.width=Number("700");
img.height=Number("700");
mc = new MovieClip();
mc = MovieClip(new SWF2());
img.source = mc;
vBox0.addChild(img);
protected function clear():void
try{
if(mc!=null){
flash.media.SoundMixer.stopAll();
img.source="";
img.source=null;
mc=null;
vBox0.removeChild(DisplayObject(img));
vBox0.removeAllElements();
vBox0.removeAllChildren();
}catch(e:Error){
Alert.show(e + " ----::---- ");
<mx:Canvas id="vBox0" width="700" height="700" ></mx:Canvas>
<mx:HBox >
<mx:Button id="checkBtn" label="first" click="checkBtn_clickHandler(event)"/>
<mx:Button id="critcalBtn" label="second" click="critcalBtn_clickHandler(event)"/>
</mx:HBox>
now my error gone!!! but one problem is there when i unload my first SWF and load second SWF(on button click), my first SWF sound are still play in Background, i cn't unstand Y this will happen coz i already remove all object and child from my Canvas.
any help on this.... -
Loading and Unloading of swf files in SWF Loader
Hi all,
I have a doubt reg. SWF Loader.
I have created two mxml files A & B.
A. local.mxml
B. SwfSample.mxml
i have two labels and a button in A file and i have set values to those labels and have a method to handle the click event of the button. In B file i have loaded this A file and accessed the labels and methods using SystemManager Component and changed the values of the A file's label and accessed data from A file to B file.
Here comes the problem,
I have two buttons named LoadAgain and Unload
When i click the Unload button, the SWF Loader unloads its content by the method i handled for the Unload button, after that i have clicked on the LoadAgain button to load the same content of A's mxml to the SWF Loader, it loads succesfully,but i was not able to access its Label or Method from the B mxml. Please help me to solve the issue.
local.mxml
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute">
<mx:Script>
<![CDATA[
Bindable]
public var varOne:String = "This is a public variable";
public function setVarOne(newText:String):void
varOne = newText;
]]>
</mx:Script>
<mx:Label id="lblOne" text="I am here" x="28" y="88"/>
<mx:Label text="{varOne}" x="166" y="88"/>
<mx:Button label="Nested Button" click="setVarOne('Nested Button Pressed');" x="28" y="114"/>
SwfSample.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.SystemManager;
import mx.controls.Label;
Bindable]
public var loadedSM:SystemManager;
private function initNestedAppProps():void
loadedSM = SystemManager(myLoader.content);
public function updateLabel():void
lbl.text = loadedSM.application[
"lblOne"].text;
public function updateNestedLabels():void
loadedSM.application[
"lblOne"].text = "I was just updated" ;
loadedSM.application[
"varOne"] = "I was just updated";
public function updateNestedVarOne():void
local(loadedSM.application).setVarOne(
"Updated varOne");
public function unload():void
myLoader.content.loaderInfo.loader.unload();
public function loadAgain():void
myLoader.load(
"../bin-debug/local.swf");
]]>
</mx:Script>
<mx:Label id="lbl" x="72" y="47"/>
<mx:SWFLoader id="myLoader" width="438" source="../bin-debug/local.swf" creationComplete="initNestedAppProps();" y="73" height="238" x="72" alpha="1.0"/>
<mx:Button label="Update Label Control in Outer Application" click="updateLabel();" x="72" y="319"/>
<mx:Button label="Update Nested Controls" click="updateNestedLabels();" x="72" y="349"/>
<mx:Button label="Update Nested varOne" click="updateNestedVarOne();" x="72" y="379"/>
<mx:Button label="Unload" click="unload();" x="72" y="409"/>
<mx:Button label="Load Again" click="loadAgain();" x="72" y="439"/>
</mx:Application>
Thanks & regards,
Sathish.KcreationComplete only fires once when the SWFLoader is created. Therefore you never reset your variables to point to the new sub-app. On a slow network, creationComplete may fire before the sub-app loads. It is best to use the COMPLETE event.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
Profiling the loading and unloading of modules
Modules appear to be the ideal solution for building complex rich internet applications but first hand experience has also shown me that they can leak memory like nothing else. I've read anything and everything I could find about modules and module loading/unloading including of Alex Harui's blog post "What We Know About Unloading Modules" that reveals a number of potential leak causes that should be considered.
I've now created a simple soak test that repeatedly loads and unloads a specified module to help identify memory leaks using the profiler. However, even with the most basic of modules, I find that memory usage will steadily grow. What I'd like to know is what memory stuff is unavoidable flex overhead associated with the loading of modules and what memory stuff am I guilty for, for not cleaning up object references? I'd like to be able to establish some baseline values to which I will be able to compare future modules against.
I've been following the approach suggested in the Adobe Flash Builder 4 Reference page "Identifying problem areas"
"One approach to identifying a memory leak is to first find a discrete set of steps that you can do over and over again with your application, where memory usage continues to grow. It is important to do that set of steps at least once in your application before taking the initial memory snapshot so that any cached objects or other instances are included in that snapshot."
Obviously my set of discrete steps is the loading and unloading of a module. I load and unload the module once before taking a memory snapshot. Then I run my test that loads and unloads the module a large number of times and then take another snapshot.
After running my test on a very basic module for 200 cycles I make the following observations in the profiler:
Live Objects:
Class
Package (Filtered)
Cumulative Instances
Instances
Cumulative Memory
Memory
_basicModule_mx_core_FlexModuleFactory
201 (1.77%)
201 (85.17%)
111756 (24.35%)
111756 (95.35%)
What ever that _basicModule_mx_core_FlexModuleFactory class is, it's 201 instances end up accounting for over 95% of the memory in "Live Objects".
Loitering Objects:
Class
Package
Instances
Memory
Class
600 (9.08%)
2743074 (85.23%)
_basicModule_mx_core_FlexModuleFactory
200 (3.03%)
111200 (3.45%)
However this data suggests that the _basicModule_mx_core_FlexModuleFactory class is the least of my worries, only accounting for 3.45% of the total memory in "Loitering Objects". Compare that to the Class class with it's 600 instances consuming over 85% of the memory. Exploring the Class class deeper appears to show them all to be the [newclass] internal player actions.
Allocation Trace:
Method
Package (Filtered)
Cumulative Instances
Self Instances
Cumulative Memory
Self Memory
[newclass]
1200 (1.39%)
1200 (14.82%)
2762274 (13.64%)
2762274 (62.76%)
This appears to confirm the observations from the "Loitering Objects" table, but do I have any influence over the internal player actions?
So this brings me back to my original question:
What memory stuff is unavoidable flex overhead associated with the loading of modules and what memory stuff am I guilty for, for not cleaning up object references? If these are the results for such a basic module, what can I really expect for a much more complex module? How can I make better sense of the profile data?
This is my basic module soak tester (sorry about the code dump but there's not that much code really):
basicModule.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
layout="absolute" width="400" height="300"
backgroundColor="#0096FF" backgroundAlpha="0.2">
<s:Label x="165" y="135" text="basicModule" fontSize="20" fontWeight="bold"/>
</mx:Module>
moduleSoakTester.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
width="400" height="300" backgroundColor="#D4D4D4"
initialize="application_initializeHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.ModuleEvent;
[Bindable]
public var loadCount:int = -1;
[Bindable]
public var unloadCount:int = -1;
public var maxCycles:int = 200;
public var loadTimer:Timer = new Timer(500, 1);
public var unloadTimer:Timer = new Timer(500, 1);
protected function application_initializeHandler(event:FlexEvent):void
loadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, loadTimer_timerCompleteHandler);
unloadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, unloadTimer_timerCompleteHandler);
protected function loadModule():void
if(loadCount < maxCycles)
moduleLoader.url = [correctPath] + "/basicModule.swf";
moduleLoader.loadModule();
loadCount++;
protected function unloadModule():void
moduleLoader.unloadModule();
unloadCount++;
protected function load_clickHandler(event:MouseEvent):void
load.enabled = false;
loadModule();
unload.enabled = true;
protected function unload_clickHandler(event:MouseEvent):void
unload.enabled = false;
unloadModule();
run.enabled = true;
protected function run_clickHandler(event:MouseEvent):void
run.enabled = false;
moduleLoader.addEventListener(ModuleEvent.READY, moduleLoader_readyHandler);
moduleLoader.addEventListener(ModuleEvent.UNLOAD, moduleLoader_unloadHandler);
loadTimer.start();
protected function moduleLoader_readyHandler(event:ModuleEvent):void
unloadTimer.start();
protected function moduleLoader_unloadHandler(event:ModuleEvent):void
loadTimer.start();
protected function loadTimer_timerCompleteHandler(event:TimerEvent):void
loadModule();
protected function unloadTimer_timerCompleteHandler(event:TimerEvent):void
unloadModule();
]]>
</fx:Script>
<mx:ModuleLoader id="moduleLoader"/>
<s:VGroup x="20" y="20">
<s:HGroup>
<s:Button id="load" label="Load" click="load_clickHandler(event)" enabled="true"/>
<s:Button id="unload" label="Unload" click="unload_clickHandler(event)" enabled="false"/>
<s:Button id="run" label="Run" click="run_clickHandler(event)" enabled="false"/>
</s:HGroup>
<s:Label text="loaded: {loadCount.toString()}" fontSize="15"/>
<s:Label text="unloaded: {unloadCount.toString()}" fontSize="15" x="484" y="472"/>
</s:VGroup>
</s:Application>
Cheers,
-DamonEasiest way I've found to get your SDK version from within Builder is to add this: <mx:Label text="{mx_internal::VERSION}" />
http://blog.flexexamples.com/2008/10/29/determining-your-flex-sdk-version-number/
Peter -
How to include Freight charges and unloading charges in Material price.
Hi All,
Can you pls. advice how we can include freight charges & unloading charges in Material price (MAP) when receive in system.
Current Situation :
We buy Switchgears from vendor, which transported with special vehicle arrangement from different service provider and gets unloaded at warehouse by another service provider. Currently business create seperate PO for Material vendor, Freight Vendor and for unloading service provider. But MAP is only updated with Material cost only. How can I include delivery cost and unloading cost in MAP thro standard SAP process.
Your solution will help business heaps.
Regards,Hi,
Create three condition types namely basic material price, freight charges & unloading charges.
For basic material price , you can copy PB00 and rename your basic material price condition type.Now freight charges & unloading charges condition type in M/06 , do not maintain condition category ( keep it blank ), so that it will added to inventory cost .For freight charges & unloading charges do not maintain account key & accrual key in Pricing procedure.
Cretae PO , now you will see all cost added to NET price in PO and you can for doing GR where all cost are inventoried as materisl cost.
Regards,
Biju K -
How to load and unload more than one external swf files in different frames?
I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
ThanksLook into using the Loader class to load the swf files. If you want to have it happen in different frames then you can put the code into the different frames.
-
Can we load and unload the files in the run time?
Can we load and unload the files in the run time?
For example there are four files named "test1.h & test1.c" and another set "test2.h & test2.c" (I attached them as attachment to this post).
test1.h contains code:
int variable; //variable declared as integer
test1.c contains code:
variable = 1; //variable assigned a value
test1.h contains code:
char *variable; //variable declared as string
test1.c contains code:
variable = "EXAMPLE"; //variable assigned a string
So here, in this case can I dynamically load / unload the first & second group of files so that the same variable name "variable" can be used both as integer and string? And if yes, how is that to be done?
Solved!
Go to Solution.
Attachments:
test.zip 1 KBWhat do you mean by "dynamically"?
If you want to have a variable that either is an int or a char in the same program run, I'm afraid your only option is to define it as a variant and assign from time to time the proper data type in the variant according to some condition. Next, every time you access the variable you must firstly check which data type is stored in it, next access it in the proper way.
If on the other hand your option or to have a run in which the variable is an int, next you stop the program and in a following run it is a char, you may have it by using some appropriade preprocessor clause:
#ifdef CHAR_TYPE
#include "test1.h"; // variable defined as a char
#else
#include "test2.h"; // variable defined as int
#endif
Next, every time you want to access the variable you must proceed in the same vay:
#ifdef CHAR_TYPE
variable = "string";
#else
variable = 1;
#endif
Does it worth the effort?
Additionally, keep in mind that this "dynamical" approach can work only in the IDE, where you can properly #define your CHAR_TYPE or not depending on your wishes: when you compile the program, it will have only one #include depending on the definition of the macro.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
TestStand don't unload handle in a DLL after step is executed and unloaded
Hi,
Sorry for the 'Google' English. I hope you can understand my problem.
I developed a DLL (in C, under Visual C++.NET 2003) to program board by Ethernet. Then I developed VIs (LV 7.1) for this DLL. It's work very well.
I adapted these VIs for TestStand 2.0.1 (Test Data indicator and Input buffer command - with the good connector). I had sometime error -18002 (Server close VI) then I configured steps so that TS load them dynamically and unload after the steps execution.
With this step configuration, I can unloaded an Access file opened in a VI.
In the DLL, I open another ASCII file then I close it before go back under LabVIEW. When I launch the VIs without using TestStand ('Edit code' and run under LV), I can launch the programming several times. But if I use 'Run selected step', I can launch only one programming: the file can't be open any more (handle already used). If I do 'run selected step' several times (4 to 5 times), I have an error -18002 and I must close LabVIEW and TestStand for all to free. I tested on another PC which works very well but there too I have the same problem.
How do I have to configure TestStand to be sure that it releases the resource? Thank you in advance for your help.
My NI login didn't work since many months (thanks Laura F. of ni.com to solve this problem) so I posted this message on NI France (SR 7158216). Today, they did not find a solution yet. The support tested the call of a DLL (opening/closing of a file) CVI directly under TestStand without problem. They must test the call of the DLL in one VI, called under TestStand. If somebody encountered already this problem and found a solution, that interests me because my customer want now to have his program speedly. Thanks a lot.
Regards.
PS:
If that can help somebody: LabVIEW does not like 'BOOL' and 'u_char' types in a DLL: the DLL works without error but the result is bad. It is to better use 'int' (instead of 'BOOL') and 'unsigned char' (instead of 'u_char') even of they are used in an internal function with the DLL. I must search a long time before understand this problem.Thanks for your answer
.NIDays2008 {font-family:Arial, Helvetica, sans-serif; font-size:12px; color: #065fa3; font-weight: bold; text-decoration: none; text-align: right;} .NIDays2008 a, a:hover {text-decoration: none;} .NIDays2008 a img {height: 0; width: 0; border-width: 0;} .NIDays2008 a:hover img {position: absolute; height: 90px; width: 728px; margin-left: -728px; margin-top:-12px;}
>> Avez-vous entendu parler de NI Days ? -
Problem : Load PDF or similiar files( stored at operating system) into an oracle table using SQl*Loader .
and than Unload the files back from oracle tables to prevoius format.
I 've used SQL*LOADER .... " sqlldr " command as :
" sqlldr scott/[email protected] control=c:\sqlldr\control.ctl log=c:\any.txt "
Control file is written as :
LOAD DATA
INFILE 'c:\sqlldr\r_sqlldr.txt'
REPLACE
INTO table r_sqlldr
Fields terminated by ','
id sequence (max,1) ,
fname char(20),
data LOBFILE(fname) terminated by EOF )
It loads files ( Pdf, Image and more...) that are mentioned in file r_sqlldr.txt into oracle table r_sqlldr
Text file ( used as source ) is written as :
c:\kalam.pdf,
c:\CTSlogo1.bmp
c:\any1.txt
after this load ....i used UTL_FILE to unload data and write procedure like ...
CREATE OR REPLACE PROCEDURE R_UTL AS
l_file UTL_FILE.FILE_TYPE;
l_buffer RAW(32767);
l_amount BINARY_INTEGER ;
l_pos INTEGER := 1;
l_blob BLOB;
l_blob_len INTEGER;
BEGIN
SELECT data
INTO l_blob
FROM r_sqlldr
where id= 1;
l_blob_len := DBMS_LOB.GETLENGTH(l_blob);
DBMS_OUTPUT.PUT_LINE('blob length : ' || l_blob_len);
IF (l_blob_len < 32767) THEN
l_amount :=l_blob_len;
ELSE
l_amount := 32767;
END IF;
DBMS_LOB.OPEN(l_blob, DBMS_LOB.LOB_READONLY);
l_file := UTL_FILE.FOPEN('DBDIR1','Kalam_out.pdf','w', 32767);
DBMS_OUTPUT.PUT_LINE('File opened');
WHILE l_pos < l_blob_len LOOP
DBMS_LOB.READ (l_blob, l_amount, l_pos, l_buffer);
DBMS_OUTPUT.PUT_LINE('Blob read');
l_pos := l_pos + l_amount;
UTL_FILE.PUT_RAW(l_file, l_buffer, TRUE);
DBMS_OUTPUT.PUT_LINE('writing to file');
UTL_FILE.FFLUSH(l_file);
UTL_FILE.NEW_LINE(l_file);
END LOOP;
UTL_FILE.FFLUSH(l_file);
UTL_FILE.FCLOSE(l_file);
DBMS_OUTPUT.PUT_LINE('File closed');
DBMS_LOB.CLOSE(l_blob);
EXCEPTION
WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN(l_file) THEN
UTL_FILE.FCLOSE(l_file);
END IF;
DBMS_OUTPUT.PUT_LINE('Its working at last');
END R_UTL;
This loads data from r_sqlldr table (BOLBS) to files on operating system ,,,
-> Same procedure with minor changes is used to unload other similar files like Images and text files.
In above example : Loading : 3 files 1) Kalam.pdf 2) CTSlogo1.bmp 3) any1.txt are loaded into oracle table r_sqlldr 's 3 rows respectively.
file names into fname column and corresponding data into data ( BLOB) column.
Unload : And than these files are loaded back into their previous format to operating system using UTL_FILE feature of oracle.
so PROBLEM IS : Actual capacity (size ) of these files is getting unloaded back but with quality decreased. And PDF file doesnt even view its data. means size is almot equal to source file but data are lost when i open it.....
and for images .... imgaes are getting loaded an unloaded but with colors changed ....
Also features ( like FFLUSH ) of Oracle 've been used but it never worked
ANY SUGGESTIONS OR aLTERNATE SOLUTION TO LOAD AND UNLOAD PDFs through Oracle ARE REQUESTED.
------------------------------------------------------------------------------------------------------------------------Thanks Justin ...for a quick response ...
well ... i am loading data into BLOB only and using SQL*Loader ...
I've never used dbms_lob.loadFromFile to do the loads ...
i 've opend a file on network and than used dbms_lob.read and
UTL_FILE.PUT_RAW to read and write data into target file.
actually ...my process is working fine with text files but not with PDF and IMAGES ...
and your doubt of ..."Is the data the proper length after reading it in?" ..m not getting wat r you asking ...but ... i think regarding data length ..there is no problem... except ... source PDF length is 90.4 kb ..and Target is 90.8 kb..
thats it...
So Request u to add some more help ......or should i provide some more details ?? -
Mass change recipient and unloading point on material
Hello Experts,
Is there a way to mass change recipient and unloading point on materials in PS?
It is quite a task to go into every parts general data screen and enter it there
rgds
GAROk,
Thanks for your reply
rgds
GAR -
Hi,
I'm struggling to understand this, so I'm hoping someone can explain how to further enhance the functionality of my simple unload function, or maybe just point out some best practices in unloading external content.
The scenario is that I'm loading and unloading external swfs into my movie(many, many times over) In order to load my external content, I am doing the following:
Declare global loader:
var assetLdr:Loader = new Loader();
Load the content using this function:
function loadAsset(evt:String):void{
var assetName:String = evt;
if (assetName != null){
assetLdr = new Loader();
var assetURL:String = assetName;
var assetURLReq:URLRequest = new URLRequest(assetURL);
assetLdr.load(assetURLReq);
assetLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded)
assetLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayAssetLoaderProgress);
function loaded(event:Event):void {
var targetLoader:Loader = Loader(event.target.loader);
assetWindow.addChild(targetLoader);
Unload the content using this function:
function unloadAsset(evt:Loader) {
trace("UNLOADED!");
evt.unload();
Do the unload by calling the function via:
unloadAsset(assetLdr)
This all seems to work pretty well, but at the same time I am suspicious that the content is not truly unloaded, and some reminents of my previously loaded content is still consuming memory. Per my load and unload function, can anyone suggest any tips, tricks or pointers on what to add to my unload function to reallocate the consumed memory better than how I'm doing it right now, or how to make this function more efficient at clearing the memory?
Thanks,
~ChiplehSince you use a single variable for loader, from GC standpoint the only thing you can add is unloadAndStop().
Besides that, your code has several inefficiencies.
First, you add listeners AFTER you call load() method. Given asynchronous character of loading process, especially on the web, you should always call load() AFTER all the listeners are added, otherwise you subject yourself to unpredictable results and bud that are difficult to find.
Second, nested function are evil. Try to NEVER use nested functions. Nested functions may be easily the cause for memory management problems.
Third, your should strive to name variables in a manner that your code is readable. For whatever reason you name functions parameters evt although a better way to would be to name them to have something that is descriptive of a parameter.
And, please, when you post the code, indent it so that other people have easier time to go through it.
With that said, your code should look something like that:
function loadAsset(assetName:String):void{
if (assetName) {
assetLdr = new Loader();
assetLdr.contentLoaderInfo.addEventListener(Event.INIT , loaded);
assetLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayAssetLoaderProgress);
// load() method MUST BE CALLED AFTER listeners are added
assetLdr.load(new URLRequest(assetURL));
// function should be outside of other function.
function loaded(e:Event):void {
var targetLoader:Loader = Loader(event.target.loader);
assetWindow.addChild(targetLoader);
function unloadAsset(loader:Loader) {
trace("UNLOADED!");
loader.unload();
loader.unloadAndStop(); -
Redirect [SWF] and [Unload SWF] trace?
Hi all!
I was wondering if there is a way to redirect or disable
[SWF] and [Unload SWF] based messages when working with external
SWFS.
Ideally I would like to redirect trace statements, but I
doubt that's possible.
Thanks!I would like to add a question to this topic, but instead of describing it, I would like to refer to this forum, where it was described very good: http://www.gotoandlearnforum.com/viewtopic.php?f=33&t=28730
In short:
When the loader object is only referenced by a local variable within a method and there's no other reference to the loader, other than the EventListener, the loaded SWF file is being sporadically unloaded (by the GC perhaps) before I am able to access the loader.content! That's kind of a bug, I guess and not acceptable!
So any help would be much appreciated!
Regards,
Matthias -
RemoveChild and Stop all Animation/Sound plz help!!
Hey hope someone can help me out with this, been stuck on this for a while now and tried a number of different way but no luck so far.
Im trying to removechild and at the same time stop all the on going animation and sound, in a way reset them so that if this child is added again it plays like it did the first time.
I've tried these scripts but non work, either i get an error or the sound doesnt stop and the animations stack:
//==================================================
1.
bgFarm.stopImmediatePropagation()
2.
while (bgFarm.numChildren != 0)
bgFarm.removeChildAt(0);
3.
gameMain_Controls.islandBG.removeChild(bgFarm);
===================================================
the bgFarm is added to the main background from another class
thx, hope someone can help
pavelIf all are done in script things are easier but I assume you're using timeline MovieClips. Generally speaking, stop() stops the timeline and removeChild() removes a DisplayObject (such as MovieClip) from a DisplayObjectContainer (such as Sprite and MovieClip). As for the sound, if you manage it by script it's easy to stop a sound with SoundChannel.stop(), but if your sound is on the timeline you have not much control. Either SoundMixer.stopAll() (but this stops ALL the sounds) or set SoundTransform volume to 0.
Maybe you are looking for
-
Error while DDIC ACTIVATION while installation SP stack
Hi Gurus I face an error while I was installation one SP stack via SPAM in DDIC ACTIVATION phase. When I check log file ULOG09_2 I found 2 more systems are sending requests to my system in question. Here is the scenario My system in trouble DV2 other
-
MacBook Pro getting hot quickly
I bought a MacBook Pro in November, and it seems to get hot very quickly. It is usually just sitting on a desk. It sounds like the fan is working, but I don't know a solution. I have a Speck case on it, but I don't think that would be an issue? Is th
-
I erased all content and settings from i phone because my dad gave it to me i press and hold both buttons i conected it to the itunes but it tells me its not available and my iphone doesnt open what shall i do?
-
Friends, I need to select some fields from two different tables which doesnot contain any field in common.How to Get this using a select query.. But there is a field X in table 1 which is equalient to eight char of another field y in table 2.I
-
Hi, all infotypes are stored in one table.plz tell me that table name??? itz urgent for me. Thanks P>SRIKANTH