Full download Flex Solutions Essential Techniques for Flex 2 and 3 Developers 1st Edition Marco Casario pdf docx
Full download Flex Solutions Essential Techniques for Flex 2 and 3 Developers 1st Edition Marco Casario pdf docx
Full download Flex Solutions Essential Techniques for Flex 2 and 3 Developers 1st Edition Marco Casario pdf docx
https://ebookgate.com
https://ebookgate.com/product/flex-solutions-
essential-techniques-for-
flex-2-and-3-developers-1st-edition-marco-casario/
https://ebookgate.com/product/the-essential-guide-to-flex-3-essential-
guide-1st-edition-charles-e-brown/
ebookgate.com
https://ebookgate.com/product/flex-4-in-action-revised-edition-of-
flex-3-in-action-dan-orlando/
ebookgate.com
https://ebookgate.com/product/enterprise-development-with-flex-best-
practices-for-ria-developers-adobe-dev-lib-1st-edition-yakov-fain/
ebookgate.com
https://ebookgate.com/product/flex-on-java-bernerd-allmon/
ebookgate.com
Flex Mobile in Action 1st Edition Jonathan Campos
https://ebookgate.com/product/flex-mobile-in-action-1st-edition-
jonathan-campos/
ebookgate.com
https://ebookgate.com/product/jasperreports-3-5-for-java-
developers-1st-edition-heffelfnger/
ebookgate.com
https://ebookgate.com/product/pentaho-reporting-3-5-for-java-
developers-gorman/
ebookgate.com
https://ebookgate.com/product/physics-for-scientists-and-engineers-
student-solutions-manual-volume-2-v-2-3-5th-edition-david-mills/
ebookgate.com
https://ebookgate.com/product/oracle-core-essential-internals-for-
dbas-and-developers-1st-edition-jonathan-lewis/
ebookgate.com
CYAN YELLOW
MAGENTA BLACK
Flex Solutions
Essential Techniques for
Learn best practices and tips from a Flex expert for structuring the architecture of Flex applications.
Use the Flex Remote Procedure Classes to connect to remote data with HTTPServices and the Java™ Platform,
PHP, ColdFusion, WebServices, and RemoteObject.
Essential Techniques
Use the new Flex 3 features, such as the AdvancedDataGrid component and the Charting Enhancements feature.
Port your Rich Internet Applications onto the desktop with Adobe AIR.
this print for reference only—size & color not accurate spine = 1.694" 904 page count
8768FM.qxd 10/31/07 2:12 PM Page i
Flex Solutions
Essential Techniques for
Flex 2 and 3 Developers
Marco Casario
8768FM.qxd 10/31/07 2:12 PM Page ii
Credits
Lead Editors Associate Production Director
Chris Mills, Ben Renow-Clarke Kari Brooks-Copony
Manufacturing Director
Tom Debolski
8768FM.qxd 10/31/07 2:12 PM Page iii
CONTENTS AT A GLANCE
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 829
v
8768FM.qxd 10/31/07 2:12 PM Page vi
8768FM.qxd 10/31/07 2:12 PM Page vii
CONTENTS
vii
8768FM.qxd 10/31/07 2:12 PM Page viii
CONTENTS
viii
8768FM.qxd 10/31/07 2:12 PM Page ix
CONTENTS
Solution 2-8: Extending the Event class for sending complex data . . . . . . . . . . . . . . 94
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
How to build it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Solution 2-9: Creating SWC files to deploy components . . . . . . . . . . . . . . . . . . 103
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Solution 2-10: Creating reusable components using template components . . . . . . . . 107
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 3: Working with Data Models and the Value Object . . . . . . 115
Solution 3-1: Using MXML data models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
How to build it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
An <mx:XML> variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Solution 3-2: Loading external XML data using MXML data models. . . . . . . . . . . . . 123
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Solution 3-3: ActionScript classes as data models. . . . . . . . . . . . . . . . . . . . . . . 126
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Solution 3-4: Using data binding with data models . . . . . . . . . . . . . . . . . . . . . . 134
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Solution 3-5: Converting an MXML data model into an ActionScript object . . . . . . . . 140
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
How to build it . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
ix
8768FM.qxd 10/31/07 2:12 PM Page x
CONTENTS
x
8768FM.qxd 10/31/07 2:12 PM Page xi
CONTENTS
Chapter 6: Working with Remote Data Using the RPC Classes . . . . . . 239
Solution 6-1: Using the HTTPService class . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Solution 6-2: Handling result and fault events. . . . . . . . . . . . . . . . . . . . . . . . . 246
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Solution 6-3: Loading dynamically generated XML using PHP and ActionScript . . . . . . 255
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Solution 6-4: Using the E4X format with the resultFormat property . . . . . . . . . . . . 265
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Solution 6-5: Sending parameters to a PHP and a JSP file . . . . . . . . . . . . . . . . . . 271
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Solution 6-6: Consuming a web service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Solution 6-7: Using the RemoteObject with ColdFusion Flash Remoting . . . . . . . . . . 289
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
xi
8768FM.qxd 10/31/07 2:12 PM Page xii
CONTENTS
Solution 6-8: Remote communication with the Flash Player URLLoader class . . . . . . . 298
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Solution 6-9: Using the RemoteObject with AMFPHP. . . . . . . . . . . . . . . . . . . . . 302
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
xii
8768FM.qxd 10/31/07 2:12 PM Page xiii
CONTENTS
xiii
8768FM.qxd 10/31/07 2:12 PM Page xiv
CONTENTS
xiv
8768FM.qxd 10/31/07 2:12 PM Page xv
CONTENTS
xv
8768FM.qxd 10/31/07 2:12 PM Page xvi
CONTENTS
Solution 12-2: Working with events and effects with chart components . . . . . . . . . . 670
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 671
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
Solution 12-3: Adding video contents within Flex. . . . . . . . . . . . . . . . . . . . . . . 682
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
Solution 12-4: Printing from a DataGrid . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
Solution 12-5: Debugging applications with the Logging framework . . . . . . . . . . . . 699
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706
Solution 12-6: Uploading files to the server . . . . . . . . . . . . . . . . . . . . . . . . . 707
What’s involved . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
How to build it. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
Expert tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
xvi
8768FM.qxd 10/31/07 2:12 PM Page xvii
CONTENTS
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
829
xvii
8768FM.qxd 10/31/07 2:12 PM Page xviii
Another random document with
no related content on Scribd:
from the altar, and, stripping it of its decorations, threw it into the
street. At that very moment the earthquake began. As it happened,
however, a priest who was hurrying away from danger saw the image,
picked it up and carried it into a neighbouring church, where it was
reverently placed upon an altar. At that very moment the earthquake
ceased, and so from that time to this the fifth of May is a holiday, which
is second in importance only to Independence Day. It used to be that
this image was taken from the altar on these occasions, carried through
the streets under a scarlet canopy, and was followed by a procession
which included the president of the republic, his cabinet, members of
congress, justices, archbishop, bishop and all of the other prelates of the
Church and thousands of people with bands of music and regiments of
soldiers. This saint became known as Saint Cinco de Mayo (Saint Fifth of
May), because the woman who threw it into the street and her family
were killed in the earthquake, and it was impossible to ascertain what
particular saint it was originally intended to represent. In recent years,
however, this celebration has lost much of its importance, although the
Church still recognizes it as a regular holiday in its calendar.
The high fees charged for the services of the Church have been much
criticized, and deservedly so. In most places not a single service will be
performed without the payment of the fee in advance. This is specially
to be condemned in the case of the fees that are charged for marriages.
Although a marriage to be legal in Chile must have a civil ceremony, for
which only a small charge is made, yet those who are devoted to the
Church consider the religious ceremony the essential one. As the priests
will not perform this ceremony without the regular fee being paid, which
amounts to several dollars, and the contracting parties do not consider
the civil ceremony as of any value, because they are so instructed by the
priesthood, the result is that neither ceremony is performed, and an
injustice is done to all parties concerned. Even in the higher circles great
confusion sometimes arises where the man, for instance, considers the
civil ceremony necessary, and the woman, under the advice of her
counsellor, is not willing to have it performed. The result has been
considerable confusion, and also has made the Church and civil
authorities unnecessarily opposed to each other in many instances.
Many claim that South America is not a legitimate field for Protestant
missionary work. Their theory is that the country was at one time
evangelized by missionaries, and therefore should not be touched by
other missionary effort. The fact is that religious conditions in South
America savour much of the darkness of the Middle Ages. There is to-
day an unbelief and utter indifference to spiritual things among the men,
which is hard to realize until one has had actual contact with it.
Whatever effort can better these conditions, and thereby improve the
morals of the people, should be encouraged. The Roman Catholics
pursue their efforts among the strongest Protestant countries, and they
should not be criticized for so doing. If they can reach a class or
element that has not been touched by Protestant effort, they are
thereby doing good for that nation and the world in general. True
religion and true Christianity should be recognized and encouraged
under whatever name it may be found. It would be far better if the
Catholic Church in Chile, and other South American countries, would
welcome the Protestant ministers, and join hands with them in their
efforts to raise the standards of living among the people.
One will find signs of the Protestant invasion of Chile from Arica, in
the extreme north, to Tierra del Fuego. The movement has generally
been accompanied by educational enterprise, of which there are several
splendid examples in Chile. One of these is the American College for
Girls, and the Instituto Ingles, an institution for boys, both of which are
in Santiago. The former, which is under the control and direction of the
Methodist Episcopal Church, has achieved more than a national
reputation in Chile, and many of the very best families send their girls to
that college for their education. It is recognized as giving the very best
education that can be obtained in the Republic, and the enrollment has
included the names of the children of presidents of the republic, and
many others in high authority. The same may be said of the latter
institution, which is under the control of the American Presbyterian
Church, and which is always crowded to its utmost capacity, with many
names upon the waiting list who cannot be accommodated. The patrons
of the two institutions understand that the schools are Protestant
schools, that the Bible is read and studied, that morning prayers are
compulsory, but beyond that the students are at liberty to attend any
religious services that may be desired by the parents. Outside of the
regular religious services, no effort is made to alienate the students from
the church in which they have been baptized. The Methodists also
conduct grammar schools at Concepción and Iquique, and schools of the
primary and lower grammar grades at other places. In all more than fifty
day schools are conducted by these two denominations. The work that
has been begun is a beneficial one in a moral way, and the results have
been very satisfactory to those engaged in the work.
At the present time the American Presbyterian and the Methodist
Episcopal Churches are the only American denominations that are
aggressively doing missionary work in Chile. The former began their
work in 1873, and the latter in 1878. The Methodists have thirty
missionaries and a large number of native workers assisting them, and
have established fifty-eight stations. The Presbyterians have twenty-six
missionaries, and these workers, together with native helpers, are at
work in sixty-five different communities. Both in Valparaiso and Santiago
there is a Union Church, to which members of various Protestant bodies
come for the religious services, and both of these churches are doing a
very effective work.
The Protestant Anglican Church was the first to begin any evangelistic
work in Chile. Its first mission was established more than sixty years
ago. They began work in the extreme south, and still have stations on
Tierra del Fuego for the Indians. They also have churches at Santiago,
Valparaiso, Iquique, Concepción and Punta Arenas for the English-
speaking people who live in those cities.
The American and British Bible Societies have aggressively spread
over the country. The colporteurs of these societies have gone up and
down over the country, by train and coach, on foot and mule-back, with
copies of the Scriptures in various languages. These books are sold for a
very small sum, and, if the person is too poor to buy, they are freely
given. The work has not always been easy or pleasant, for such deep
prejudice is oftentimes encountered that insults and little indignities
have followed.
CHAPTER XIV
THE STRUGGLE FOR INDEPENDENCE
At the election in 1831, General Don Joaquin Prieto was chosen chief
magistrate. Although he owed his elevation to the military power, the
new President did not attempt the role of dictator at first. He was ably
seconded by his chief cabinet officer, Señor Portales, one of the ablest
statesmen that Chile has produced. After two years of careful
preparation a new constitution was promulgated in 1833. Although it
has been amended from time to time to meet new conditions, just as
has our own constitution, this instrument has remained the fundamental
law of the land. It gave to Chile a strong and stable government. The
foundation of the government, under the franchise conditions, was the
property-holding class. Political power originated in an oligarchy which
obtained control of Congress. Although such a possibility was not
designed in the constitution, it gradually developed a government by
dictators. This was due to the turbulent character of the people.
Extraordinary powers were granted from time to time in order to
suppress revolutionary outbreaks. These powers included the right to
suspend the constitutional guarantees, to imprison and exile political
suspects without trial, and to adopt such other arbitrary measures as
the executive might deem advisable. All of these powers were invoked
by President Prieto before the end of his first term.
As there was no constitutional inhibition against a second term Prieto
was reelected in 1836, and Portales retained his portfolio. All branches
of the government had been reformed over the former chaotic
conditions, and industrial progress had been rapid. The credit of the
country was good, and interest was paid promptly. Life in the new
republic, however, was not dull. It was sometimes necessary to put
down disorders with a firm hand. Opponents were banished without
mercy. Peru seemed to have favoured those who sought refuge on her
soil, and war was declared against that republic. Several battles were
fought, and Chile captured the entire Peruvian navy, consisting of three
vessels. Portales was killed, and a serious repulse finally compelled
Prieto to make peace. This caused trouble at home, and it gave Prieto’s
enemies a chance to denounce the war and its outcome. A new
expedition was sent against Peru under General Bulnes, and this
expedition was successful. The Bolivian-Peruvian dictator was
overwhelmingly defeated, and this success made Chile the dominant
power on the Pacific Coast, a position which it has retained ever since.
At the election in 1841 General Manuel Bulnes was chosen president.
He was a very distinguished soldier. Owing to his training as a soldier,
President Bulnes had little idea of any method of administration other
than by force. His course toward political opponents was severe, and all
attempts to dispute his authority were crushed with an iron hand.
Nevertheless, during the ten years administration of Bulnes, prosperity
made great strides and Chile became a nation of influence and
importance. The growth of the customs revenues placed the
government finances on a sound footing. The President fostered
education and other reforms. A more liberal religious atmosphere began
to grow up. Mines were discovered and opened. The Liberals began to
be more numerous, but Bulnes was outspoken in his opposition to them.
In spite of their opposition he succeeded in selecting Manuel Montt as
his own successor in 1851.
The new President was a civilian and had been a member of the
Supreme Court, and many reforms were expected from him. More would
probably have been granted by him, for his standing was of the highest,
had not a serious disturbance broken out just a few days after his
inauguration. The headquarters of the revolutionists were at
Concepción. Proceeding toward the capital they won several small
victories. The decisive battle of Loncomilla followed, however, in which
the government was victorious, but not until five thousand Chileans had
lost their lives in this internecine warfare. Peace and general amnesty
followed this victory, and equilibrium was quickly established. Montt
welcomed liberals among his followers. A number of administrative
reforms were adopted, although the liberal program was strenuously
opposed. New treaties with the leading commercial nations were
negotiated. Nevertheless the policy of centralizing the entire government
with the bureaucracy of Santiago was followed up. Many leading liberals
were exiled. During his second term Montt attempted to grant a greater
degree of political liberties, but insurrections broke out in the north and
south, and there was bloody rioting in Valparaiso. This led to a renewal
of drastic measures. Montt finally came into open rupture with Congress,
because it favoured the return of his political enemies, among whom
were some of the ablest men in the republic. The clergy were angry
because they were compelled to submit their decisions to the civil
tribunals. He became more and more dictatorial in his methods.
Newspapers were suppressed, meetings dispersed, and agitators
imprisoned. President Montt succeeded in putting down the various
insurrections. In spite of defeat on the field of battle the liberals in fact
won a victory, for their cause was forced on the government. It was
obliged to make some concessions in order to prevent a renewal of the
conflict. The government was in this condition when Montt’s second
term reached an end in 1861.
José Joaquin Perez, a man of high personal prestige, was unanimously
chosen as Montt’s successor. From the very commencement of his
administration Chile began to enjoy a freedom unknown in the
preceding thirty years. Criticism of the government was encouraged,
instead of being treated as a crime to be punished by imprisonment or
banishment. The policy of President Perez was one of conciliation, in
order to unite the discordant elements. A law was at once passed
granting amnesty to political offenders. The extraordinary powers
heretofore granted to dictatorial presidents was not even asked for by
Perez, nor did he need it. Railroads were opened up, and colonists
began to come in. Fierce parliamentary struggles over certain reform
measures followed in Congress, and there were many changes of
ministry.
The only serious disturbance of the Perez administration was a brief
war with Spain, which occurred in 1864-5. The dispute was primarily
between Spain and Peru, but Chile took the part of the latter, for fear
that Spain might seek to reestablish her authority in South America. As a
result Valparaiso was blockaded by the Spaniards and bombarded.
Millions of dollars worth of property were destroyed in a few hours, but
the Chileans would not yield and grant the apology demanded. Public
feeling ran very high for a few months. Chile had only one war-ship, but
this boat captured a Spanish gunboat. This so humiliated the Spanish
commander, Admiral Pareja, that he suicided. Although the war did not
officially end for many years, nothing hostile was done by Spain after
the bombardment of Valparaiso. Perez was reelected as a matter of
course in 1866, and finished his second term. Pressure for amendments
to the constitution had become very strong, for the foreign influences
were becoming noticeable. A measure was passed forbidding a president
to be reelected to succeed himself, and this marks an important step in
the evolution of political ideals. A desperate effort was made to
enfranchise all who could read and write. This measure, although
favoured by Perez, was defeated, but the property qualification was
greatly reduced. In every way the two administrations of President Perez
marked the beginning of a new era in Chilean affairs. The rights of the
people began to receive greater consideration from politicians.
The election of 1871 was hotly contested. The liberals were very
aggressive. The conservatives united with the moderates, and Federico
Errázuriz, an astute politician, was chosen. This election practically
marks the elimination of the conservatives as an important element for
several presidential terms. It was not long after this election until more
radical elements controlled Congress, and Errázuriz sided with the
liberals in their program of reforms. The great issue was the amenability
of the clergy to the civil law. The anti-clerical party forced through this
law, and made concessions to Protestant worship. The requirement of
obligatory teaching of the Catholic religion in the public schools was
greatly modified. The Archbishop promptly excommunicated all who
voted for these laws, and the breach between the liberals and clericals
was further widened. The administration of President Errázuriz was
marked by considerable internal improvement and the beginning of a
greater navy, which was soon to be very useful. Political reforms went
forward with increasing momentum, but not without the usual results.
As soon as the liberals had things in their power, the various factions
into which they were divided began to intrigue among themselves for
congressional majorities. Material prosperity had continued until the
great world panic of 1873. The government customs fell and financial
troubles followed, but the debt was successfully refunded. One of the
most remarkable features of this administration was that the same
Prime Minister held his office during the entire term of four years
without interruption.
The election of 1876 brought out several candidates. In former years
the retiring President had practically selected his successor. More liberal
ideas now prevailed, and the Chileans were called upon to decide for
themselves who should be their chief magistrate. There were three
active candidates, among whom was Señor Anibal Pinto, who was
nominated by the moderates and elected. President Pinto was a man of
studious habits and a strong advocate of peaceful measures. And yet
this man of peace was called upon to preside over the nation during one
of its most severe trials. Never did he falter, even when war became
necessary, and never did he waver in his determination to protect
Chilean interests.
The dispute with Argentina over the southern boundary had by this
time become acute. Public feeling in both republics had reached such a
stage that peace was threatened. A previous treaty had declared that
the boundary should be the same as in colonial times. This was hazy
and uncertain, because that section had been and still was uninhabited.
No one had ever been concerned about it. Chile had always claimed the
Andes to the east and Cape Horn to the south. Punta Arenas had been
founded thirty-five years previously without serious opposition from
Argentina. For years this controversy continued between the two
countries, but impending war with Peru hastened a treaty. The territorial
limitations were finally decided upon and Chile practically got all that she
had contended for. Chile obtained practical control of both ends of the
Straits, although the channel was declared neutral and neither nation
can erect any fortifications along it.
A severe economic crisis, due to the depression in the mining industry,
also disturbed this administration, but this situation was met as well as it
could be. But all the troubles of President Pinto pale before the
sanguinary war conducted against the combined forces of Peru and
Bolivia, in which the lives of twenty thousand of his subjects were
sacrificed.
CHAPTER XV
THE NITRATE WAR
The early Spaniards were very little interested in geography, and the
boundaries between the provinces were often very vaguely described.
Since the independence of the various provinces these boundary lines
have been the cause of many disputes, and, in many instances, have
nearly plunged neighbouring republics into bloody war. The most serious
dispute still unsettled is between Peru and Ecuador, which involves a
large part of the territory of the latter republic.
The older readers will remember that, when they studied geography,
Bolivia had a stretch of sea coast along the desert of Atacama. For a
considerable time after independence was secured little attention was
paid to Atacama, since it was regarded as worthless for colonization.
Chile claimed sovereignty, and its jurisdiction was generally recognized.
The year 1840 brought a change. In that year the wealth of fertilizer
along that coast began to be exploited. Disputes soon arose between
Chile and Bolivia as to the boundary line. The various claims made by
Bolivia were inconsistent. War threatened, and diplomatic relations
between the two countries were broken off. The outbreak of hostilities
between Spain and Peru united the two countries against what they
considered a common enemy. A treaty was drawn up in 1866 by which
the 24th degree of south latitude was agreed upon as the actual
boundary, although the Chileans were allowed to continue their
operations in the nitrate regions beyond that line. Furthermore, Chile
was to pay over to Bolivia half the customs received between the 24th
and 25th degrees, and Bolivia was to hand over to Chile half the
customs received between the 23rd and 24th degrees, south latitude. It
was also provided that neither party to the treaty could alienate its
rights to a foreign government.
DIGGING NITRATE.