Showing posts with label or. Show all posts
Showing posts with label or. Show all posts

Tuesday, January 27, 2015

Embedding or linking audio files in PowerPoint

Do you always wonder why audio inserted in your PowerPoint presentation disappear when you play presentation on a computer other than the one where it was created? Do you fail to understand why online PowerPoint sharing websites like authorSTREAM, slideboom or slideshare (BTW they dont support audio inserted in PowerPoint file) fail to play audio inserted in your Presentation?

Answer to these questions lie in the way audio was inserted in PowerPoint. There are two methods of inserting audio files in PowerPoint presentations. Either you can embed audio in PowerPoint itself or link the audio file.

As per Microsoft
"Main differences between embedded (embedded object: Information (object) contained in a source file and inserted into a destination file. Once embedded, the object becomes part of the destination file. Changes you make to the embedded object are reflected in the destination file.) sounds (objects) (object: A table, chart, graphic, equation, or other form of information. Objects created in one application, for example spreadsheets, and linked or embedded in another application are OLE objects.) and linked (linked object: An object that is created in a source file and inserted into a destination file, while maintaining a connection between the two files. The linked object in the destination file can be updated when the source file is updated.) sounds are where they are stored and how you update them after you put them in your presentation. Embedded files are stored within the presentation, and linked files are stored outside the presentation."


In case of linked files, PowerPoint always play audio from the linked location of file( say "c:my Documents est.wmv"). When you play PowerPoint file having linked audio on some other machine, PowerPoint file tries to locate and play audio file from linked path i.e. "c:my Documents est.wmv". As there is no such audio file at the path specified on new machine so audio fails to play. Embedded audio file is contained in PowerPoint itself so audio will play on online presentation sharing websites or on other computers.


Audio file of size more than 50 MB will always be linked. You may have to set audio file size from advance options so that audio file below 50 MB is always embedded. Follow steps below:






See videos on how to insert audio in PowerPoint file.









You can visit links below to understand difference between linked and embedded audio:


Office 2003

http://office.microsoft.com/en-us/powerpoint/HA010348231033.aspx

office 2007

http://office.microsoft.com/en-us/powerpoint/HA012303071033.aspx
Read more »

Monday, January 19, 2015

Preloading External SWF File Generates Error 1009 Cannot access a property or method of a null object reference

Exercise Files:
Stage_Issue_Preloader.fla
Stage_Issue_Load_This.fla

When youre preloading a SWF file that has code that makes any reference to the stage, you might encounter this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

Lets take a look at the sample files and see if well get that same error. Make sure that youve downloaded them and placed them in the same folder. We have 2 files:
  1. Stage_Issue_Preloader - this Flash movie will be used to preload the other file
  2. Stage_Issue_Load_This - this Flash movie will be the one thats preloaded into the preloader movie
Both files already have code in them.

Lets open the Stage_Issue_Load_This.fla file first. Go ahead and test the movie so that Flash will generate a SWF file inside the same folder that contains our Flash documents. What happens in this movie is when you hit the enter key on your keyboard, the smiley face in the center of the stage will rotate. Try it out, but make sure that you disable keyboard shortcuts by going to Control > Disable Keyboard Shortcuts. What the movie does is not really important. Whats important here is that if you take a look at the code in frame 1 of the Actions layer, you will see a reference to the stage at the beginning of the code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);
So just take note of this line. Although it does not seem to be causing any errors now, it will once we try to preload it into the preloader file. So lets try that.

Open the Stage_Issue_Preloader.fla file. Check the code on frame 1 of the Actions layer and you will see that we already have our basic preloader code that will preload the Stage_Issue_Load_This.swf file. Now test the movie and you should see that same error message I mentioned at the beginning of this article:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

This error mentions a null object. When you say null object, it means that the object has no value and, in a way, is kind of like a non-existent object. And the null object being referred to here is actually the stage.

But how can the stage be null? Isnt there already a stage when the preloader file is launched?
Yes. But the problem is that stage can only be accessed from a display object thats already in the display list. Our stage reference (the line that says stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);) is inside the Stage_Issue_Load_This.swf file. Thats the file thats being preloaded, and it wont get added to the display list until it has loaded completely. So essentially, this means that for a certain amount of time while its being loaded, it actually wont have a stage. So thats why stage is being seen as null. You see, when youre loading an external SWF file in Flash, it can actually start reading the code inside that SWF file even though it hasnt completely loaded yet. So in this circumstance, what happens is that the external SWF file hasnt been completely loaded yet, but Flash is already trying to execute the code inside it. So its trying to execute the stage.addEventListener... line, but as weve learned, the external SWF file does not have a stage yet. But once its been loaded completely and has been added to the display list, then the stage reference inside the Stage_Issue_Load_This.swf file will no longer be null.

So how do we fix this?
Well take a look at 3 ways in which we can fix this issue. Basically, what we want to do is to make sure that stage is not null when the stage.addEventListener... line gets executed.


Method #1
For the first method, we will be adding some code to the Stage_Issue_Load_This.fla file (thats the file thats going to be preloaded). So make sure that file is open, then select frame 1 of the Actions layer and then go to the Actions panel. What well do is we will add an event handler that will tell us when the Flash movie has been added to the stage. The event for that is Event.ADDED_TO_STAGE. This event gets dispatched by the display object whenever its been added to the stage. So when our Flash movie gets added to the stage, only then will we let Flash execute the stage.addEventListener... line. So well create an Event.ADDED_TO_STAGE event handler, and then place the stage.addEventListener... line inside the event listener function associated with that event handler.
this.addEventListener(Event.ADDED_TO_STAGE, checkStage);

function checkStage(e:Event):void
{

stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);
this.removeEventListener(Event.ADDED_TO_STAGE, checkStage); //Dont forget to remove the ADDED_TO_STAGE event listener after the stage.addEventListener... line has been added already
}
So here, we have an event listener function named checkStage that gets called when the Flash movie has been added to the stage. Once its called, only then will the stage.addEventListener... line be executed. And since the Flash movie has already been added to the stage, then we wont get the previous error anymore.

*Make sure that you test this movie first in order to generate the SWF file with the updated code before you test it with the preloader movie.

The problem with this method, though, is that the movie wont work properly if you run it by itself (meaning when you dont load it using the preloader file). When you run the Flash movie by itself, then the Event.ADDED_TO_STAGE event never gets dispatched. So the stage.addEventListener... line never gets executed. The Event.ADDED_TO_STAGE event doesnt get dispatched because when you run the Flash movie by itself, it never adds itself to its own stage. It has to be loaded by another Flash movie and then be added to that Flash movies stage, in order for the Event.ADDED_TO_STAGE event to be dispatched. So lets go ahead and take a look at other methods as well.


Method #2
For this second method, we will be adding some code to the Stage_Issue_Load_This.fla file as well (thats the file thats going to be preloaded). So make sure that file is open, then select frame 1 of the Actions layer and then go to the Actions panel. What well do is we will add some sort of checker that will check whether stage is not equal to null (if stage is not equal to null, then this means that our external SWF file already has a stage). If the stage is still null, then dont execute the code. But if the stage is no longer null, then Flash can go ahead and execute the stage.addEventListener... line. So lets take that stage.addEventListener... line and put it in an if statement that checks if stage is not equal to null.
if(stage != null) {
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);
}

But this is not quite complete yet. This if statement will only run once. We want it to keep running so that its going to keep on checking until stage is no longer equal to null. And one way of making this if statement execute numerous times would be to put it in an ENTER_FRAME event handler.
this.addEventListener(Event.ENTER_FRAME, checkStage);

function checkStage(e:Event):void
{


if(stage != null)
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);
}

}
So here, Ive created an ENTER_FRAME event handler that calls the listener function named checkStage. And inside the checkStage listener function is the if statement that checks if stage is not equal to null. And since this is an ENTER_FRAME event handler, this function is going to run numerous times. Therefore, the if statement inside it will keep checking if stage is no longer null. So weve ensured that only then will the stage.addEventListener... line be executed, thus avoiding the error.

And also, lets not forget to remove the ENTER_FRAME event listener once stage is no longer null, since by that time, we no longer need to check for that condition. If we dont remove the listener then it will keep on running and needlessly take up computing resources.
this.addEventListener(Event.ENTER_FRAME, checkStage);

function checkStage(e:Event):void
{

if(stage != null)
{
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotateSmileys);
this.removeEventListener(Event.ENTER_FRAME, checkStage);
}

}
*Make sure that you test this movie first in order to generate the SWF file with the updated code before you test it with the preloader movie.


Method #3
In this third method, the code will be added to the Stage_Issue_Preloader.fla file instead. This fix is much shorter. Youll only need to transfer an already existing line to the top part of the code. But before we add the code, lets take a quick look at how a loader object works:
When an external SWF file is loaded by a loader object, the SWF file gets loaded as a child of the loader object. This is another way of saying that the external SWF file actually goes inside the loader. Once loading is complete, we can then add the loader to the stage. And since the loaded SWF file is inside the loader, then the SWF file gets added to the stage along with it. Just keep that in mind as the fix in this method has something to do with that.

So now, lets go ahead and edit the code. Make sure that the Stage_Issue_Preloader.fla file is open, then select frame 1 of the Actions layer and then go to the Actions panel. Scroll down until you see the function named loaded.
function loaded(e:Event):void
{
removeChild(percent_txt);
removeChild(progressBar_mc);
addChild(myLoader);
}
This function named loaded is the listener function for the Event.COMPLETE event handler in the code. This function will get called only when the loader object has finished loading the external SWF file. It is in this function where we add the loader object named myLoader to the stage. So this means that the loader object only gets added to the stage at the end of the loading process. But we can actually add the loader earlier. We can add it to the display list immediately after we create it, and before we even start the loading process. Instead of having the addChild(myLoader); statement inside the event listener function, lets just place it after we instantiate the loader object.
var myLoader:Loader = new Loader();
var myURL:URLRequest = new URLRequest("Stage_Issue_Load_This.swf");

addChild(myLoader);
This way, the loader gets added to the stage immediately. It will be empty at first, but it will already be on the stage. And thats OK. You can place empty loader objects on the stage. It does not have to have content in order for it to be placed on the stage.

So why do we need to add the
loader before we start the loading process? Well, because if the loader is already on the stage, it means that the externally loaded SWF file gets added to the stage right away as well (since we know that the SWF actually goes inside the loader). And since its added to the stage right away, this means that stage will not be null.

If in the first and second methods, we made it so that the Flash movie will wait for stage to NOT be null before it executes the stage.addEventListener... statement, here, weve made it so that the external SWF file has a stage right away when it starts getting loaded into the Flash movie.

You can choose any of the methods, and hopefully, it will fix this issue for you.
Read more »

Monday, January 12, 2015

How to Backup or Restore Blogger Template

Blogger let you backup your whole blog template. Keeping a backup copy of the template is specially necessary for new bloggers. If youre a new user you may customize your blog by taking helps from others. But if you make any mistake you may lose your customized blog template. In that case you have nothing to do other than restoring the default template. 

However if you keep a backup copy of your blog template then you can use it in other blogs too! Even you can share the same template with your friends. Besides if you make significant changes of your template and get it back in a previous stage then you must have a backup copy. 

To backup or restore your blogger template follow the steps below: 
  1. First make sure youre signed in on your blogger account.
  2. Then go to design.
  3. Now click on the Template button from the left panel. 
  4. Then click on Backup/ Restore button from the top right corner of the screen.
  5. To download the template, hit on Download Full Template button. And if you wanna restore template then choose previously saved template file. 
The following picture may be useful for you. 





Stay with Marks PC Solution to get more interesting IT topics!
Read more »